Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

Commit f6988b4

Browse files
author
Simone Mosciatti
committed
fix possible race condition in test
1 parent 49cc690 commit f6988b4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/correctness/test.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ def test_multi_statement_multi_table_single_bind(self):
275275
result = self.exec_cmd("A", "SELECT * FROM t2 ORDER BY A;")
276276
self.assertEquals(result, [[2], [4]])
277277

278+
def test_multi_statement_different_bindings(self):
279+
with DB(self, "A"):
280+
with Table(self, "t1", "(A INTEGER)", key = "A"):
281+
ok = self.exec_naked("REDISQL.CREATE_STATEMENT", "A", "insert", "insert into t1 values(?1); insert into t1 values(?2 + 1); select * from t1;")
282+
self.assertEquals(ok, "OK")
283+
result = self.exec_naked("REDISQL.EXEC_STATEMENT", "A", "insert", "3", "8")
284+
self.assertEquals(result, [[3], [9]])
285+
278286

279287
def test_update_statement(self):
280288
with DB(self, "A"):
@@ -434,12 +442,13 @@ def test100(self):
434442
self.assertEquals(done, ["DONE", 0L])
435443
for i in xrange(catty):
436444
self.exec_naked("HSET", "cat:" + str(i), "meow", i)
445+
time.sleep(0.5)
437446
result = self.exec_naked("REDISQL.EXEC", "A", "SELECT * FROM cats")
438447
self.assertEquals(catty, len(result))
439448

440449
def test_rdb_persistency(self):
441-
with DB(self, "A"):
442-
done = self.exec_naked("REDISQL.EXEC", "A", "CREATE VIRTUAL TABLE cats USING REDISQL_TABLES_BRUTE_HASH(cat, meow)")
450+
with DB(self, "Y"):
451+
done = self.exec_naked("REDISQL.EXEC", "Y", "CREATE VIRTUAL TABLE cats USING REDISQL_TABLES_BRUTE_HASH(cat, meow)")
443452

444453
for i in xrange(5):
445454
self.exec_naked("HSET", "cat:" + str(i), "meow", i)
@@ -448,7 +457,7 @@ def test_rdb_persistency(self):
448457
pass
449458
time.sleep(0.5)
450459

451-
result = self.exec_naked("REDISQL.EXEC", "A", "SELECT rowid, cat, meow FROM cats")
460+
result = self.exec_naked("REDISQL.EXEC", "Y", "SELECT rowid, cat, meow FROM cats")
452461
self.assertEquals(5, len(result))
453462
self.assertTrue([0L, "cat:0", "0"] in result)
454463
self.assertTrue([1L, "cat:1", "1"] in result)

0 commit comments

Comments
 (0)