[Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool
Yaroslav Dynnikov
yaroslav.dynnikov at tarantool.org
Thu May 20 00:50:49 MSK 2021
HI, Vlad
Thanks for the patch.
Find one comment below.
On Thu, 13 May 2021 at 14:07, Vladislav Shpilevoy <v.shpilevoy at 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.
> vshard.storage.bucket_force_drop(1)
>
> vshard.storage.buckets_info()
> --
> 2.24.3 (Apple Git-128)
>
>
Best regards
Yaroslav Dynnikov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210520/1f349663/attachment.htm>
More information about the Tarantool-patches
mailing list