Skip to content
Permalink
Browse files
Fix dtest-offheap.materialized_views_test.TestMaterializedViews.test_…
…mv_with_default_ttl_with_flush

patch by Berenguer Blasi; reviewed by Andres de la Peña for CASSANDRA-17605
  • Loading branch information
bereng committed May 12, 2022
1 parent 8b7c3cc commit 9092c68f0c3d5ee6152471c8bbd499c8e5657378
Showing 1 changed file with 38 additions and 11 deletions.
@@ -1399,22 +1399,49 @@ def _test_mv_with_default_ttl(self, flush):
assert_one(session, "SELECT * FROM mv", [1, 3, 1])

# user provided ttl
self.update_view(session, "UPDATE t USING TTL 50 SET a = 4 WHERE k = 1", flush)
assert_one(session, "SELECT * FROM t", [1, 4, 1])
assert_one(session, "SELECT * FROM mv", [1, 4, 1])
start = time.time()
self.update_view(session, "UPDATE t USING TTL 100 SET a = 4 WHERE k = 1", flush)
try:
assert_one(session, "SELECT * FROM t", [1, 4, 1])
assert_one(session, "SELECT * FROM mv", [1, 4, 1])
except AssertionError as ae:
if (time.time() - start) >= 100:
pytest.fail("Please increase the 100 TTL which expired before we could test due to a slow env.")
else:
raise ae

self.update_view(session, "UPDATE t USING TTL 40 SET a = 5 WHERE k = 1", flush)
assert_one(session, "SELECT * FROM t", [1, 5, 1])
assert_one(session, "SELECT * FROM mv", [1, 5, 1])
start = time.time()
self.update_view(session, "UPDATE t USING TTL 80 SET a = 5 WHERE k = 1", flush)
try:
assert_one(session, "SELECT * FROM t", [1, 5, 1])
assert_one(session, "SELECT * FROM mv", [1, 5, 1])
except AssertionError as ae:
if (time.time() - start) >= 80:
pytest.fail("Please increase the 80 TTL which expired before we could test due to a slow env.")
else:
raise ae

self.update_view(session, "UPDATE t USING TTL 30 SET a = 6 WHERE k = 1", flush)
assert_one(session, "SELECT * FROM t", [1, 6, 1])
assert_one(session, "SELECT * FROM mv", [1, 6, 1])
start = time.time()
self.update_view(session, "UPDATE t USING TTL 60 SET a = 6 WHERE k = 1", flush)
try:
assert_one(session, "SELECT * FROM t", [1, 6, 1])
assert_one(session, "SELECT * FROM mv", [1, 6, 1])
except AssertionError as ae:
if (time.time() - start) >= 60:
pytest.fail("Please increase the 60 TTL which expired before we could test due to a slow env.")
else:
raise ae

if flush:
self.cluster.compact()
assert_one(session, "SELECT * FROM t", [1, 6, 1])
assert_one(session, "SELECT * FROM mv", [1, 6, 1])
try:
assert_one(session, "SELECT * FROM t", [1, 6, 1])
assert_one(session, "SELECT * FROM mv", [1, 6, 1])
except AssertionError as ae:
if (time.time() - start) >= 60:
pytest.fail("Please increase the 60 TTL which expired before we could test due to a slow env.")
else:
raise ae

@flaky
@since('3.0')

0 comments on commit 9092c68

Please sign in to comment.