Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the latest Tarantool
@ 2021-11-22 22:43 Vladislav Shpilevoy via Tarantool-patches
  2021-11-23  4:33 ` Бабин Олег via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-11-22 22:43 UTC (permalink / raw)
  To: tarantool-patches, olegrok

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)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches]  [PATCH vshard 1/1] test: fix tests on the latest Tarantool
  2021-11-22 22:43 [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the latest Tarantool Vladislav Shpilevoy via Tarantool-patches
@ 2021-11-23  4:33 ` Бабин Олег via Tarantool-patches
  2021-11-23 23:17   ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Бабин Олег via Tarantool-patches @ 2021-11-23  4:33 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]


Hi! Thanks for your fix. LGTM.

  
>Вторник, 23 ноября 2021, 1:43 +03:00 от Vladislav Shpilevoy <v.shpilevoy@tarantool.org>:
> 
>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.
>  
 
 
--
Oleg Babin
 

[-- Attachment #2: Type: text/html, Size: 882 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the latest Tarantool
  2021-11-23  4:33 ` Бабин Олег via Tarantool-patches
@ 2021-11-23 23:17   ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-11-23 23:17 UTC (permalink / raw)
  To: Бабин Олег
  Cc: tarantool-patches

Hi! Thanks for the review!

Pushed to master.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-23 23:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 22:43 [Tarantool-patches] [PATCH vshard 1/1] test: fix tests on the latest Tarantool Vladislav Shpilevoy via Tarantool-patches
2021-11-23  4:33 ` Бабин Олег via Tarantool-patches
2021-11-23 23:17   ` Vladislav Shpilevoy via Tarantool-patches

Tarantool development patches archive

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lists.tarantool.org/tarantool-patches/0 tarantool-patches/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tarantool-patches tarantool-patches/ https://lists.tarantool.org/tarantool-patches \
		tarantool-patches@dev.tarantool.org.
	public-inbox-index tarantool-patches

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git