From 7b9cf528adecc79dc37f2a07fe137ff8efbf8258 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Sun, 17 Jul 2016 16:13:30 -0300 Subject: [PATCH] tests: fix occassional failure in date tiered test That was a bug in the test itself. It could happen that a sstable would incorrectly belong to the next time window if the current minute is approaching its end. Fix is about having all sstables that we want in the same time window with the same min/max timestamp. Fixes #1448. Signed-off-by: Raphael S. Carvalho Message-Id: --- tests/sstable_datafile_test.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/sstable_datafile_test.cc b/tests/sstable_datafile_test.cc index 6d27414107..f278c1c025 100644 --- a/tests/sstable_datafile_test.cc +++ b/tests/sstable_datafile_test.cc @@ -2766,13 +2766,12 @@ SEASTAR_TEST_CASE(basic_date_tiered_strategy_test) { int min_threshold = cf->schema()->min_compaction_threshold(); auto now = db_clock::now(); auto past_hour = now - std::chrono::seconds(3600); + int64_t timestamp_for_now = now.time_since_epoch().count() * 1000; int64_t timestamp_for_past_hour = past_hour.time_since_epoch().count() * 1000; for (auto i = 1; i <= min_threshold; i++) { - auto tp = now + std::chrono::seconds(i); - int64_t timestamp_for_this_sst = tp.time_since_epoch().count() * 1000; auto sst = add_sstable_for_overlapping_test(cf, /*gen*/i, "a", "a", - build_stats(timestamp_for_this_sst, timestamp_for_this_sst, std::numeric_limits::max())); + build_stats(timestamp_for_now, timestamp_for_now, std::numeric_limits::max())); candidates.push_back(sst); } // add sstable that belong to a different time tier.