Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, olegrok@tarantool.org
Subject: [Tarantool-patches] [PATCH vshard 3/7] test: disable router discovery for some tests
Date: Fri,  1 May 2020 02:16:30 +0200	[thread overview]
Message-ID: <badc06d86e3f52b59453184d42f2f1e5d0537e47.1588292014.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1588292014.git.v.shpilevoy@tarantool.org>

There are tests, which are not related to discovery at all, and
yet they suffer from unrelated changes, when something is modified
in the discovery algorithm. For example, it highly affects the
test about request retries and automatic timeouts.

Now the discovery is disabled for such tests, since it becomes
easily possible to do with the new router's configuration option.
---
 example/router.lua                       |  3 +++
 test/router/exponential_timeout.result   | 12 +++++++-----
 test/router/exponential_timeout.test.lua |  4 +++-
 test/router/retry_reads.result           |  6 ++++--
 test/router/retry_reads.test.lua         |  4 +++-
 test/router/router.result                |  9 ++++++++-
 test/router/router.test.lua              |  5 ++++-
 7 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/example/router.lua b/example/router.lua
index 6d0b45e..23f6c65 100755
--- a/example/router.lua
+++ b/example/router.lua
@@ -14,6 +14,9 @@ replicasets = {'cbf06940-0790-498b-948d-042b62cf3d29',
 
 -- Call a configuration provider
 cfg = require('localcfg')
+if arg[1] == 'discovery_disable' then
+    cfg.discovery_mode = 'off'
+end
 cfg.listen = 3300
 
 -- Start the database with sharding
diff --git a/test/router/exponential_timeout.result b/test/router/exponential_timeout.result
index f579382..252b816 100644
--- a/test/router/exponential_timeout.result
+++ b/test/router/exponential_timeout.result
@@ -28,7 +28,9 @@ util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memt
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
 ---
 ...
-_ = test_run:cmd("start server router_1")
+-- Discovery algorithm changes sometimes and should not affect the
+-- exponential timeout test.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 ---
 ...
 _ = test_run:switch('router_1')
@@ -49,13 +51,13 @@ util.collect_timeouts(rs1)
     ok: 0
     timeout: 0.5
   - fail: 0
-    ok: 1
+    ok: 0
     timeout: 0.5
 ...
 util.collect_timeouts(rs2)
 ---
 - - fail: 0
-    ok: 1
+    ok: 0
     timeout: 0.5
   - fail: 0
     ok: 0
@@ -74,7 +76,7 @@ util.collect_timeouts(rs1)
     ok: 0
     timeout: 0.5
   - fail: 0
-    ok: 9
+    ok: 8
     timeout: 0.5
 ...
 _ = rs1:callrw('echo')
@@ -86,7 +88,7 @@ util.collect_timeouts(rs1)
     ok: 0
     timeout: 0.5
   - fail: 0
-    ok: 1
+    ok: 9
     timeout: 0.5
 ...
 --
diff --git a/test/router/exponential_timeout.test.lua b/test/router/exponential_timeout.test.lua
index 75b0028..881b9a7 100644
--- a/test/router/exponential_timeout.test.lua
+++ b/test/router/exponential_timeout.test.lua
@@ -10,7 +10,9 @@ util.wait_master(test_run, REPLICASET_1, 'storage_1_a')
 util.wait_master(test_run, REPLICASET_2, 'storage_2_a')
 util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')')
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
-_ = test_run:cmd("start server router_1")
+-- Discovery algorithm changes sometimes and should not affect the
+-- exponential timeout test.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 _ = test_run:switch('router_1')
 util = require('util')
 
diff --git a/test/router/retry_reads.result b/test/router/retry_reads.result
index ae60267..fa38541 100644
--- a/test/router/retry_reads.result
+++ b/test/router/retry_reads.result
@@ -28,7 +28,9 @@ util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memt
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
 ---
 ...
-_ = test_run:cmd("start server router_1")
+-- Discovery algorithm changes sometimes and should not affect the
+-- read retry decisions.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 ---
 ...
 _ = test_run:switch('router_1')
@@ -53,7 +55,7 @@ util.collect_timeouts(rs1)
     ok: 0
     timeout: 0.5
   - fail: 0
-    ok: 1
+    ok: 0
     timeout: 0.5
 ...
 _ = rs1:callro('sleep', {min_timeout + 0.5}, {timeout = min_timeout})
diff --git a/test/router/retry_reads.test.lua b/test/router/retry_reads.test.lua
index c1fb689..390436a 100644
--- a/test/router/retry_reads.test.lua
+++ b/test/router/retry_reads.test.lua
@@ -10,7 +10,9 @@ util.wait_master(test_run, REPLICASET_1, 'storage_1_a')
 util.wait_master(test_run, REPLICASET_2, 'storage_2_a')
 util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')')
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
-_ = test_run:cmd("start server router_1")
+-- Discovery algorithm changes sometimes and should not affect the
+-- read retry decisions.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 _ = test_run:switch('router_1')
 util = require('util')
 
diff --git a/test/router/router.result b/test/router/router.result
index d85f718..267a3e9 100644
--- a/test/router/router.result
+++ b/test/router/router.result
@@ -31,7 +31,8 @@ util.push_rs_filters(test_run)
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
 ---
 ...
-_ = test_run:cmd("start server router_1")
+-- Discovery should not interfere in some first tests.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 ---
 ...
 _ = test_run:switch("router_1")
@@ -697,6 +698,12 @@ vshard.router.call(bucket_id, 'write', 'vshard.storage.bucket_recv', {new_bid, '
 --
 -- Monitoring
 --
+cfg.discovery_mode = 'on'
+---
+...
+vshard.router.discovery_set('on')
+---
+...
 -- All is ok, when all servers are up.
 -- gh-103: show bucket info for each replicaset.
 info = vshard.router.info()
diff --git a/test/router/router.test.lua b/test/router/router.test.lua
index abc1a3c..c36026d 100644
--- a/test/router/router.test.lua
+++ b/test/router/router.test.lua
@@ -9,7 +9,8 @@ util.wait_master(test_run, REPLICASET_2, 'storage_2_a')
 util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')')
 util.push_rs_filters(test_run)
 _ = test_run:cmd("create server router_1 with script='router/router_1.lua'")
-_ = test_run:cmd("start server router_1")
+-- Discovery should not interfere in some first tests.
+_ = test_run:cmd("start server router_1 with args='discovery_disable'")
 
 _ = test_run:switch("router_1")
 -- gh-46: Ensure a cfg is not destroyed after router.cfg().
@@ -242,6 +243,8 @@ vshard.router.call(bucket_id, 'write', 'vshard.storage.bucket_recv', {new_bid, '
 -- Monitoring
 --
 
+cfg.discovery_mode = 'on'
+vshard.router.discovery_set('on')
 -- All is ok, when all servers are up.
 -- gh-103: show bucket info for each replicaset.
 info = vshard.router.info()
-- 
2.21.1 (Apple Git-122.3)

  parent reply	other threads:[~2020-05-01  0:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  0:16 [Tarantool-patches] [PATCH vshard 0/7] Router extended discovery Vladislav Shpilevoy
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 1/7] test: print errors in a portable way Vladislav Shpilevoy
2020-05-01 16:58   ` Oleg Babin
2020-05-02 20:08     ` Vladislav Shpilevoy
2020-05-04 14:26       ` Oleg Babin
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 2/7] router: introduce discovery_mode Vladislav Shpilevoy
2020-05-01 16:59   ` Oleg Babin
2020-05-01  0:16 ` Vladislav Shpilevoy [this message]
2020-05-01 17:00   ` [Tarantool-patches] [PATCH vshard 3/7] test: disable router discovery for some tests Oleg Babin
2020-05-02 20:09     ` Vladislav Shpilevoy
2020-05-04 14:26       ` Oleg Babin
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 4/7] test: clear route map, respecting statistics Vladislav Shpilevoy
2020-05-01 17:00   ` Oleg Babin
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 5/7] router: keep known bucket count stat up to date Vladislav Shpilevoy
2020-05-01 17:01   ` Oleg Babin
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 6/7] router: make discovery smoother in a big cluster Vladislav Shpilevoy
2020-05-01 17:01   ` Oleg Babin
2020-05-02 20:12     ` Vladislav Shpilevoy
2020-05-04 14:26       ` Oleg Babin
2020-05-04 21:09         ` Vladislav Shpilevoy
2020-05-06  8:27           ` Oleg Babin
2020-05-07 22:45   ` Konstantin Osipov
2020-05-08 19:56     ` Vladislav Shpilevoy
2020-05-09  7:37       ` Konstantin Osipov
2020-05-01  0:16 ` [Tarantool-patches] [PATCH vshard 7/7] router: introduce discovery mode 'once' Vladislav Shpilevoy
2020-05-01 17:02   ` Oleg Babin
2020-05-02 20:12     ` Vladislav Shpilevoy
2020-05-04 14:27       ` Oleg Babin
2020-05-06 20:54 ` [Tarantool-patches] [PATCH vshard 0/7] Router extended discovery Vladislav Shpilevoy

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=badc06d86e3f52b59453184d42f2f1e5d0537e47.1588292014.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=olegrok@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH vshard 3/7] test: disable router discovery for some tests' \
    /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