From dd29343a5f9c3c30cfb83ed3638f27dc857f3c12 Mon Sep 17 00:00:00 2001
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Date: Mon, 26 Feb 2018 18:57:51 +0300
Subject: [PATCH] test: check that netbox does not repeat request on schema
 change

Closes #2666
---
 test/box/net.box.result   | 64 +++++++++++++++++++++++++++++++++++++++
 test/box/net.box.test.lua | 24 +++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/test/box/net.box.result b/test/box/net.box.result
index fcd441856f..5f4e163c03 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2134,6 +2134,70 @@ disconnected -- true
 box.session.on_disconnect(nil, on_disconnect)
 ---
 ...
+--
+-- gh-2666: check that netbox.call is not repeated on schema
+-- change.
+--
+box.schema.user.grant('guest', 'write', 'space', '_space')
+---
+...
+box.schema.user.grant('guest', 'write', 'space', '_schema')
+---
+...
+count = 0
+---
+...
+function create_space(name) count = count + 1 box.schema.create_space(name) return true end
+---
+...
+c = net.connect(box.cfg.listen)
+---
+...
+c:call('create_space', {'test1'})
+---
+- true
+...
+count
+---
+- 1
+...
+c:call('create_space', {'test2'})
+---
+- true
+...
+count
+---
+- 2
+...
+c:call('create_space', {'test3'})
+---
+- true
+...
+count
+---
+- 3
+...
+box.space.test1:drop()
+---
+...
+box.space.test2:drop()
+---
+...
+box.space.test3:drop()
+---
+...
+box.schema.user.revoke('guest', 'write', 'space', '_space')
+---
+...
+box.schema.user.revoke('guest', 'write', 'space', '_schema')
+---
+...
 box.schema.user.revoke('guest', 'execute', 'universe')
 ---
 ...
+c:close()
+---
+...
+c = nil
+---
+...
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index 378dfd4ab4..b23a8830c1 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -871,4 +871,28 @@ while disconnected == false do fiber.sleep(0.01) end
 disconnected -- true
 
 box.session.on_disconnect(nil, on_disconnect)
+
+--
+-- gh-2666: check that netbox.call is not repeated on schema
+-- change.
+--
+box.schema.user.grant('guest', 'write', 'space', '_space')
+box.schema.user.grant('guest', 'write', 'space', '_schema')
+count = 0
+function create_space(name) count = count + 1 box.schema.create_space(name) return true end
+c = net.connect(box.cfg.listen)
+c:call('create_space', {'test1'})
+count
+c:call('create_space', {'test2'})
+count
+c:call('create_space', {'test3'})
+count
+box.space.test1:drop()
+box.space.test2:drop()
+box.space.test3:drop()
+box.schema.user.revoke('guest', 'write', 'space', '_space')
+box.schema.user.revoke('guest', 'write', 'space', '_schema')
+
 box.schema.user.revoke('guest', 'execute', 'universe')
+c:close()
+c = nil
-- 
GitLab