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 <raphaelsc@scylladb.com>
Message-Id: <ee25d49e7ed12b4cf7d018a08163404c3d122e56.1468782787.git.raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2016-07-17 16:13:30 -03:00
committed by Tomasz Grabiec
parent 4497204b7d
commit 7b9cf528ad

View File

@@ -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<int32_t>::max()));
build_stats(timestamp_for_now, timestamp_for_now, std::numeric_limits<int32_t>::max()));
candidates.push_back(sst);
}
// add sstable that belong to a different time tier.