Skip to content

Commit

Permalink
Divide box/ddl.test.lua test
Browse files Browse the repository at this point in the history
Divided into tests:
- box/ddl_alter.test.lua
- box/ddl_collation.test.lua
- box/ddl_collation_types.test.lua
- box/ddl_collation_wrong_id.test.lua
- box/ddl_no_collation.test.lua
- box/ddl_parallel.test.lua
- box/ddl_tuple.test.lua
- box/gh-2336-ddl_call_twice.test.lua
- box/gh-2783-ddl_lock.test.lua
- box/gh-2839-ddl_custom_fields.test.lua
- box/gh-2937-ddl_collation_field_def.test.lua
- box/gh-3290-ddl_collation_deleted.test.lua
- box/gh-928-ddl_truncate.test.lua
  • Loading branch information
avtikhon authored and kyukhin committed Apr 15, 2020
1 parent 05df6b3 commit 4a8d1eb
Show file tree
Hide file tree
Showing 28 changed files with 1,539 additions and 1,482 deletions.
1,210 changes: 0 additions & 1,210 deletions test/box/ddl.result

This file was deleted.

272 changes: 0 additions & 272 deletions test/box/ddl.test.lua

This file was deleted.

30 changes: 30 additions & 0 deletions test/box/ddl_alter.result
@@ -0,0 +1,30 @@
-- test-run result file version 2
-- index should not crash after alter
space = box.schema.space.create('test_swap')
| ---
| ...
index = space:create_index('pk')
| ---
| ...
space:replace({1, 2, 3})
| ---
| - [1, 2, 3]
| ...
index:rename('primary')
| ---
| ...
index2 = space:create_index('sec')
| ---
| ...
space:replace({2, 3, 1})
| ---
| - [2, 3, 1]
| ...
space:select()
| ---
| - - [1, 2, 3]
| - [2, 3, 1]
| ...
space:drop()
| ---
| ...
9 changes: 9 additions & 0 deletions test/box/ddl_alter.test.lua
@@ -0,0 +1,9 @@
-- index should not crash after alter
space = box.schema.space.create('test_swap')
index = space:create_index('pk')
space:replace({1, 2, 3})
index:rename('primary')
index2 = space:create_index('sec')
space:replace({2, 3, 1})
space:select()
space:drop()
44 changes: 44 additions & 0 deletions test/box/ddl_call_twice_gh-2336.result
@@ -0,0 +1,44 @@
-- test-run result file version 2
-- gh-2336 crash if format called twice during snapshot
fiber = require'fiber'
| ---
| ...

space = box.schema.space.create('test_format')
| ---
| ...
_ = space:create_index('pk', { parts = { 1,'str' }})
| ---
| ...
space:format({{ name ="key"; type = "string" }, { name ="dataAB"; type = "string" }})
| ---
| ...
str = string.rep("t",1024)
| ---
| ...
for i = 1, 10000 do space:insert{tostring(i), str} end
| ---
| ...
ch = fiber.channel(3)
| ---
| ...
_ = fiber.create(function() fiber.yield() box.snapshot() ch:put(true) end)
| ---
| ...
format = {{name ="key"; type = "string"}, {name ="data"; type = "string"}}
| ---
| ...
for i = 1, 2 do fiber.create(function() fiber.yield() space:format(format) ch:put(true) end) end
| ---
| ...

{ch:get(), ch:get(), ch:get()}
| ---
| - - true
| - true
| - true
| ...

space:drop()
| ---
| ...
16 changes: 16 additions & 0 deletions test/box/ddl_call_twice_gh-2336.test.lua
@@ -0,0 +1,16 @@
-- gh-2336 crash if format called twice during snapshot
fiber = require'fiber'

space = box.schema.space.create('test_format')
_ = space:create_index('pk', { parts = { 1,'str' }})
space:format({{ name ="key"; type = "string" }, { name ="dataAB"; type = "string" }})
str = string.rep("t",1024)
for i = 1, 10000 do space:insert{tostring(i), str} end
ch = fiber.channel(3)
_ = fiber.create(function() fiber.yield() box.snapshot() ch:put(true) end)
format = {{name ="key"; type = "string"}, {name ="data"; type = "string"}}
for i = 1, 2 do fiber.create(function() fiber.yield() space:format(format) ch:put(true) end) end

{ch:get(), ch:get(), ch:get()}

space:drop()

0 comments on commit 4a8d1eb

Please sign in to comment.