Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Olga Arkhangelskaia <arkholga@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] test: use grep_log in tests
Date: Wed, 4 Mar 2020 18:31:27 +0300	[thread overview]
Message-ID: <20200304153127.uhssittpe3obggq3@tkn_work_nb> (raw)
In-Reply-To: <20200219064411.37542-1-arkholga@tarantool.org>

I like the simplification of the test you made. Please, consider several
comments below.

Please, see test-run patch comments first (see [1]), because I proposed
to rename the option from `path` to `filename`.

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-March/014638.html

WBR, Alexander Turenko.

> test: use grep_log in tests

Nit: I would make the commit header a bit more certain and point the
test name right here.

>
> Refactoring: replace grep_for_broken_lsn with grep_log from test_run.
> ---
>  test/xlog/panic_on_broken_lsn.result   | 50 +++++++++-----------------
>  test/xlog/panic_on_broken_lsn.test.lua | 29 ++++-----------
>  2 files changed, 22 insertions(+), 57 deletions(-)

>  -- Check that log contains the mention of broken LSN and the request printout
> -grep_broken_lsn(fio.pathjoin(fio.cwd(), 'panic.log'), 1)
> +path = fio.pathjoin(fio.cwd(), 'panic.log')
> +---
> +...
> +str = "LSN for 1 is used twice or COMMIT order is broken: confirmed: 1, new: 1"
>  ---
> -- '{type: ''REPLACE'', replica_id: 1, space_id: 272, index_id: 0, tuple: ["t0", "v1"]}'
> +...

I would keep the request information as proof that we found the log
entry generated by the errinj above and not something else. May be
implemented like so:

 | path = fio.pathjoin(fio.cwd(), 'replica.log')
 | str = string.format("LSN for 1 is used twice or COMMIT order is broken: confirmed: %d, new: %d, req: .*", lsn, lsn)
 | found = test_run:grep_log(nil, str, 256, {path = path})
 | (found:gsub('^.*, req: ', ''):gsub('lsn: %d+', 'lsn: <lsn>'))

(See below re 256.)

(Parenthesis are to discard the second return value of string.gsub().)

>  -- Check that log contains the mention of broken LSN and the request printout
> -grep_broken_lsn(fio.pathjoin(fio.cwd(), 'panic.log'), 1)
> -
> +path = fio.pathjoin(fio.cwd(), 'panic.log')
> +str = "LSN for 1 is used twice or COMMIT order is broken: confirmed: 1, new: 1"
> +test_run:grep_log(nil, str, nil, {path = path})~= nil

Nit: spaces are needed around '~='.

I would keep 265 bytes window (there is `bytes` option in grep_log()).
Lesser value is more safe: if the expected log entry is not appear we
can occasionally found the entry from another test if the window is big
enough for this. It means that the test may pass even when is should
not. So it is good to keep the window small.

  reply	other threads:[~2020-03-04 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  6:44 Olga Arkhangelskaia
2020-03-04 15:31 ` Alexander Turenko [this message]
2020-03-10 11:35   ` Olga Arkhangelskaia
2020-03-16  9:42     ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200304153127.uhssittpe3obggq3@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=arkholga@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] test: use grep_log in tests' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox