Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 2/3] test: check that is_local flag has no effect on temporary spaces
Date: Tue, 10 Jul 2018 16:43:26 +0300	[thread overview]
Message-ID: <24ba086ee3a2d8e2e9fb12f6c452e9108f24dbd0.1531229587.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1531229587.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1531229587.git.vdavydov.dev@gmail.com>

Follow-up #3443
---
 test/replication/local_spaces.result   | 59 ++++++++++++++++++++++++++++++++++
 test/replication/local_spaces.test.lua | 18 +++++++++++
 2 files changed, 77 insertions(+)

diff --git a/test/replication/local_spaces.result b/test/replication/local_spaces.result
index 1ee04803..06782788 100644
--- a/test/replication/local_spaces.result
+++ b/test/replication/local_spaces.result
@@ -52,12 +52,31 @@ box.space._space:insert{9000, 1, 'test', 'memtx', 0, {group_id = 2}, {}} -- erro
 ---
 - error: Replication group '2' does not exist
 ...
+-- Temporary local spaces should behave in the same fashion as
+-- plain temporary spaces, i.e. neither replicated nor persisted.
+s3 = box.schema.space.create('test3', {is_local = true, temporary = true})
+---
+...
+_ = s3:create_index('pk')
+---
+...
+s3.is_local
+---
+- true
+...
+s3.temporary
+---
+- true
+...
 _ = s1:insert{1}
 ---
 ...
 _ = s2:insert{1}
 ---
 ...
+_ = s3:insert{1}
+---
+...
 box.snapshot()
 ---
 - ok
@@ -68,6 +87,9 @@ _ = s1:insert{2}
 _ = s2:insert{2}
 ---
 ...
+_ = s3:insert{2}
+---
+...
 box.schema.user.grant('guest', 'replication')
 ---
 ...
@@ -91,6 +113,14 @@ box.space.test2.is_local
 ---
 - true
 ...
+box.space.test3.is_local
+---
+- true
+...
+box.space.test3.temporary
+---
+- true
+...
 box.space.test1:select()
 ---
 - - [1]
@@ -100,12 +130,19 @@ box.space.test2:select()
 ---
 - []
 ...
+box.space.test3:select()
+---
+- []
+...
 box.cfg{read_only = true} -- local spaces ignore read_only
 ---
 ...
 for i = 1, 3 do box.space.test2:insert{i, i} end
 ---
 ...
+for i = 1, 3 do box.space.test3:insert{i, i, i} end
+---
+...
 test_run:cmd("switch default")
 ---
 - true
@@ -116,6 +153,9 @@ _ = s1:insert{3}
 _ = s2:insert{3}
 ---
 ...
+_ = s3:insert{3}
+---
+...
 vclock = test_run:get_vclock('default')
 ---
 ...
@@ -138,6 +178,12 @@ box.space.test2:select()
   - [2, 2]
   - [3, 3]
 ...
+box.space.test3:select()
+---
+- - [1, 1, 1]
+  - [2, 2, 2]
+  - [3, 3, 3]
+...
 test_run:cmd("restart server replica")
 box.space.test1:select()
 ---
@@ -151,6 +197,10 @@ box.space.test2:select()
   - [2, 2]
   - [3, 3]
 ...
+box.space.test3:select()
+---
+- []
+...
 test_run:cmd("switch default")
 ---
 - true
@@ -178,9 +228,18 @@ s2:select()
   - [2]
   - [3]
 ...
+s3:select()
+---
+- - [1]
+  - [2]
+  - [3]
+...
 s1:drop()
 ---
 ...
 s2:drop()
 ---
 ...
+s3:drop()
+---
+...
diff --git a/test/replication/local_spaces.test.lua b/test/replication/local_spaces.test.lua
index 40cb6f97..ec676a18 100644
--- a/test/replication/local_spaces.test.lua
+++ b/test/replication/local_spaces.test.lua
@@ -25,11 +25,20 @@ box.space._space:update(s2.id, {{'=', 6, {group_id = 0}}}) -- error
 -- 0 (global) and 1 (local)
 box.space._space:insert{9000, 1, 'test', 'memtx', 0, {group_id = 2}, {}} -- error
 
+-- Temporary local spaces should behave in the same fashion as
+-- plain temporary spaces, i.e. neither replicated nor persisted.
+s3 = box.schema.space.create('test3', {is_local = true, temporary = true})
+_ = s3:create_index('pk')
+s3.is_local
+s3.temporary
+
 _ = s1:insert{1}
 _ = s2:insert{1}
+_ = s3:insert{1}
 box.snapshot()
 _ = s1:insert{2}
 _ = s2:insert{2}
+_ = s3:insert{2}
 
 box.schema.user.grant('guest', 'replication')
 test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'")
@@ -38,23 +47,30 @@ test_run:cmd("start server replica")
 test_run:cmd("switch replica")
 box.space.test1.is_local
 box.space.test2.is_local
+box.space.test3.is_local
+box.space.test3.temporary
 box.space.test1:select()
 box.space.test2:select()
+box.space.test3:select()
 box.cfg{read_only = true} -- local spaces ignore read_only
 for i = 1, 3 do box.space.test2:insert{i, i} end
+for i = 1, 3 do box.space.test3:insert{i, i, i} end
 
 test_run:cmd("switch default")
 _ = s1:insert{3}
 _ = s2:insert{3}
+_ = s3:insert{3}
 vclock = test_run:get_vclock('default')
 _ = test_run:wait_vclock('replica', vclock)
 
 test_run:cmd("switch replica")
 box.space.test1:select()
 box.space.test2:select()
+box.space.test3:select()
 test_run:cmd("restart server replica")
 box.space.test1:select()
 box.space.test2:select()
+box.space.test3:select()
 
 test_run:cmd("switch default")
 test_run:cmd("stop server replica")
@@ -63,6 +79,8 @@ box.schema.user.revoke('guest', 'replication')
 
 s1:select()
 s2:select()
+s3:select()
 
 s1:drop()
 s2:drop()
+s3:drop()
-- 
2.11.0

  parent reply	other threads:[~2018-07-10 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 13:43 [PATCH 0/3] Follow-up on replica local spaces Vladimir Davydov
2018-07-10 13:43 ` [PATCH 1/3] box: ignore read-only mode for " Vladimir Davydov
2018-07-10 13:43 ` Vladimir Davydov [this message]
2018-07-10 13:43 ` [PATCH 3/3] vinyl: implement support of " Vladimir Davydov

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=24ba086ee3a2d8e2e9fb12f6c452e9108f24dbd0.1531229587.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 2/3] test: check that is_local flag has no effect on temporary spaces' \
    /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