Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Yaroslav Dynnikov <yaroslav.dynnikov@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool
Date: Fri, 21 May 2021 21:26:45 +0200	[thread overview]
Message-ID: <2ec9e3f1-6b24-6593-174f-0ea72b56cd6b@tarantool.org> (raw)
In-Reply-To: <CAK0MaD3PofRc5-gA2q_B8QmNNpfQcj8ZnwJK=tdjNXy9c-BQPw@mail.gmail.com>

Hi! Thanks for the review!

On 19.05.2021 23:50, Yaroslav Dynnikov wrote:
> HI, Vlad
> 
> Thanks for the patch.
> Find one comment below.
> 
> On Thu, 13 May 2021 at 14:07, Vladislav Shpilevoy <v.shpilevoy@tarantool.org <mailto:v.shpilevoy@tarantool.org>> wrote:
> 
>     Duplicate key error at insertion into a space on the latest
>     Tarantool changed its message and it broke of the tests. The patch
>     updates the test so it checks only the needed part of the message
>     and does not depend on Tarantool version anymore.
>     ---
>      test/storage/storage.result   | 8 +++++---
>      test/storage/storage.test.lua | 3 ++-
>      2 files changed, 7 insertions(+), 4 deletions(-)
> 
>     diff --git a/test/storage/storage.result b/test/storage/storage.result
>     index 2c9784a..d18b7f8 100644
>     --- a/test/storage/storage.result
>     +++ b/test/storage/storage.result
>     @@ -179,10 +179,12 @@ vshard.storage.buckets_info()
>          status: active
>          id: 1
>      ...
>     -vshard.storage.bucket_force_create(1) -- error
>     +ok, err = vshard.storage.bucket_force_create(1)
>      ---
>     -- null
>     -- Duplicate key exists in unique index 'pk' in space '_bucket'
>     +...
>     +assert(not ok and err.message:match("Duplicate key exists"))
>     +---
>     +- Duplicate key exists
>      ...
>      vshard.storage.bucket_force_drop(1)
>      ---
>     diff --git a/test/storage/storage.test.lua b/test/storage/storage.test.lua
>     index 33f0498..97558f6 100644
>     --- a/test/storage/storage.test.lua
>     +++ b/test/storage/storage.test.lua
>     @@ -56,7 +56,8 @@ vshard.storage.sync(100500)
>      vshard.storage.buckets_info()
>      vshard.storage.bucket_force_create(1)
>      vshard.storage.buckets_info()
>     -vshard.storage.bucket_force_create(1) -- error
>     +ok, err = vshard.storage.bucket_force_create(1)
>     +assert(not ok and "err.message:match("Duplicate key exists))
> 
> 
> I'd suggest splitting the check in two:
> 
> 1. ok -- should be false
> 2. Then check the message matches.
> 
> Assertions usually don't provide useful errors.

In the core we try to use assertions more, because this makes the
tests easier to read. You can see right away what are the target
points of the test. This is kind of a simulation of tap tests.

I consider vshard be "half-core", so I decided to use assertions
here as well.

  reply	other threads:[~2021-05-21 19:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13 11:07 [Tarantool-patches] [PATCH 0/2] vshard.storage.buckets_count() bug Vladislav Shpilevoy via Tarantool-patches
2021-05-13 11:07 ` [Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool Vladislav Shpilevoy via Tarantool-patches
2021-05-13 20:23   ` Oleg Babin via Tarantool-patches
2021-05-19 21:50   ` Yaroslav Dynnikov via Tarantool-patches
2021-05-21 19:26     ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-05-21 21:54       ` Yaroslav Dynnikov via Tarantool-patches
2021-05-13 11:07 ` [Tarantool-patches] [PATCH 2/2] vshard: fix buckets_count() on replicas Vladislav Shpilevoy via Tarantool-patches
2021-05-13 20:23   ` Oleg Babin via Tarantool-patches
2021-05-21 19:26     ` Vladislav Shpilevoy via Tarantool-patches
2021-05-24  6:57       ` Oleg Babin via Tarantool-patches
2021-05-19 21:51   ` Yaroslav Dynnikov via Tarantool-patches
2021-05-21 19:30     ` Vladislav Shpilevoy via Tarantool-patches
2021-05-13 20:23 ` [Tarantool-patches] [PATCH 0/2] vshard.storage.buckets_count() bug Oleg Babin via Tarantool-patches
2021-05-25 20:43 ` Vladislav Shpilevoy via Tarantool-patches

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=2ec9e3f1-6b24-6593-174f-0ea72b56cd6b@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool' \
    /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