[Tarantool-patches] [PATCH 1/2] test: fix test output on latest Tarantool

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu May 13 14:07:05 MSK 2021


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"))
 vshard.storage.bucket_force_drop(1)
 
 vshard.storage.buckets_info()
-- 
2.24.3 (Apple Git-128)



More information about the Tarantool-patches mailing list