Skip to content

Commit

Permalink
memtx: add a couple of test cases to tx_man.test
Browse files Browse the repository at this point in the history
That's strange, but in this test in a group of simple test cases
there are test cases that checks replaces, updates and deletes,
but occasionally there's no test case that checks inserts.

Fix it and add simple test cases for inserts.

No logical changes.

Part of #8648
Part of #8654

NO_DOC=new test case
NO_CHANGELOG=new test case
  • Loading branch information
alyapunov committed Jun 21, 2023
1 parent 609184c commit 37b4561
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
68 changes: 68 additions & 0 deletions test/box/tx_man.result
Expand Up @@ -165,6 +165,74 @@ s:select{}
| - - [1, 2]
| ...

-- Insert read/write conflicts.
s:delete{1}
| ---
| - [1, 2]
| ...
tx1:begin()
| ---
| -
| ...
tx2:begin()
| ---
| -
| ...
tx1('s:insert{1, 1}')
| ---
| - - [1, 1]
| ...
tx2('s:insert{1, 2}')
| ---
| - - [1, 2]
| ...
tx1:commit()
| ---
| -
| ...
tx2:commit()
| ---
| - - {'error': 'Transaction has been aborted by conflict'}
| ...
s:select{}
| ---
| - - [1, 1]
| ...

-- Insert read/write conflicts, different order.
s:delete{1}
| ---
| - [1, 1]
| ...
tx1:begin()
| ---
| -
| ...
tx2:begin()
| ---
| -
| ...
tx1('s:insert{1, 1}')
| ---
| - - [1, 1]
| ...
tx2('s:insert{1, 2}')
| ---
| - - [1, 2]
| ...
tx2:commit() -- note that tx2 commits first.
| ---
| -
| ...
tx1:commit()
| ---
| - - {'error': 'Transaction has been aborted by conflict'}
| ...
s:select{}
| ---
| - - [1, 2]
| ...

-- Implicit read/write conflicts.
s:replace{1, 0}
| ---
Expand Down
20 changes: 20 additions & 0 deletions test/box/tx_man.test.lua
Expand Up @@ -54,6 +54,26 @@ tx2:commit() -- note that tx2 commits first.
tx1:commit()
s:select{}

-- Insert read/write conflicts.
s:delete{1}
tx1:begin()
tx2:begin()
tx1('s:insert{1, 1}')
tx2('s:insert{1, 2}')
tx1:commit()
tx2:commit()
s:select{}

-- Insert read/write conflicts, different order.
s:delete{1}
tx1:begin()
tx2:begin()
tx1('s:insert{1, 1}')
tx2('s:insert{1, 2}')
tx2:commit() -- note that tx2 commits first.
tx1:commit()
s:select{}

-- Implicit read/write conflicts.
s:replace{1, 0}
tx1:begin()
Expand Down

0 comments on commit 37b4561

Please sign in to comment.