From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tarantool-patches@dev.tarantool.org, olegrok@tarantool.org Subject: [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the latest Tarantool Date: Mon, 22 Nov 2021 23:43:00 +0100 [thread overview] Message-ID: <8bdbe3aacf7cb712ef25a334043e82bf2e7da7dd.1637620945.git.v.shpilevoy@tarantool.org> (raw) In the commit tarantool/39a462e09572df238b9a651447289e7fab87b9fd ("error: report ER_READONLY reason in message") the error message for the `box.error.READONLY` error was changed but vshard tests were not updated. This patch fixes them so they don't depend on this particular error message anymore. --- Branch: http://github.com/tarantool/vshard/tree/gerold103/fix-read_only-error test/storage/demote_sync_errinj.result | 7 +++++-- test/storage/demote_sync_errinj.test.lua | 3 ++- test/storage/read_only_slave.result | 12 +++++++----- test/storage/read_only_slave.test.lua | 5 +++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/test/storage/demote_sync_errinj.result b/test/storage/demote_sync_errinj.result index d40878c..cc104d9 100644 --- a/test/storage/demote_sync_errinj.result +++ b/test/storage/demote_sync_errinj.result @@ -52,9 +52,12 @@ f:status() - suspended ... -- Can not write - read only mode is already on. -s:replace{1} +ok, err = pcall(s.replace, s, {1}) --- -- error: Can't modify data because this instance is in read-only mode. +... +assert(not ok and err.code == box.error.READONLY) +--- +- true ... test_run:switch('storage_1_b') --- diff --git a/test/storage/demote_sync_errinj.test.lua b/test/storage/demote_sync_errinj.test.lua index 15b951d..7109ac5 100644 --- a/test/storage/demote_sync_errinj.test.lua +++ b/test/storage/demote_sync_errinj.test.lua @@ -17,7 +17,8 @@ cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master f = fiber.create(function() vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_a) end) f:status() -- Can not write - read only mode is already on. -s:replace{1} +ok, err = pcall(s.replace, s, {1}) +assert(not ok and err.code == box.error.READONLY) test_run:switch('storage_1_b') cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master = true diff --git a/test/storage/read_only_slave.result b/test/storage/read_only_slave.result index a42807b..c863836 100644 --- a/test/storage/read_only_slave.result +++ b/test/storage/read_only_slave.result @@ -68,9 +68,12 @@ box.cfg.read_only --- - true ... -box.schema.create_space('test3') +ok, err = pcall(box.schema.create_space, 'test3') --- -- error: Can't modify data because this instance is in read-only mode. +... +assert(not ok and err.code == box.error.READONLY) +--- +- true ... fiber = require('fiber') --- @@ -129,10 +132,9 @@ box.cfg.read_only --- - true ... -ok, err +assert(not ok and err.code == box.error.READONLY) --- -- false -- Can't modify data because this instance is in read-only mode. +- true ... fiber = require('fiber') --- diff --git a/test/storage/read_only_slave.test.lua b/test/storage/read_only_slave.test.lua index c7f08ed..98efe03 100644 --- a/test/storage/read_only_slave.test.lua +++ b/test/storage/read_only_slave.test.lua @@ -23,7 +23,8 @@ box.space.test:select{} _ = test_run:switch('storage_1_b') box.cfg.read_only -box.schema.create_space('test3') +ok, err = pcall(box.schema.create_space, 'test3') +assert(not ok and err.code == box.error.READONLY) fiber = require('fiber') function on_master_enable() box.space.test:replace{3, 3} end function on_master_disable() if not box.cfg.read_only then box.space.test:replace{4, 4} end end @@ -46,7 +47,7 @@ cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master = false vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_a) box.cfg.read_only -ok, err +assert(not ok and err.code == box.error.READONLY) fiber = require('fiber') while box.space.test:count() ~= 2 do fiber.sleep(0.1) end box.space.test:select{} -- 2.24.3 (Apple Git-128)
next reply other threads:[~2021-11-22 22:43 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-22 22:43 Vladislav Shpilevoy via Tarantool-patches [this message] 2021-11-23 4:33 ` Бабин Олег via Tarantool-patches 2021-11-23 23:17 ` 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=8bdbe3aacf7cb712ef25a334043e82bf2e7da7dd.1637620945.git.v.shpilevoy@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=olegrok@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the 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