From dbd217b8f0879de953b1a94174626b1808ae0d3d Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 10 Jun 2019 12:36:42 +0300 Subject: [PATCH] lib/storage: test GetSeriesCount --- lib/storage/index_db_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/storage/index_db_test.go b/lib/storage/index_db_test.go index 1944a7aefb..98cbabe3aa 100644 --- a/lib/storage/index_db_test.go +++ b/lib/storage/index_db_test.go @@ -382,6 +382,19 @@ func testIndexDBCheckTSIDByName(db *indexDB, mns []MetricName, tsids []TSID, isC } } + // Check timerseriesCounters only for serial test. + // Concurrent test may create duplicate timeseries, so GetSeriesCount + // would return more timeseries than needed. + if !isConcurrent { + n, err := db.GetSeriesCount() + if err != nil { + return fmt.Errorf("unexpected error in GetSeriesCount(): %s", err) + } + if n != uint64(len(timeseriesCounters)) { + return fmt.Errorf("unexpected GetSeriesCount(); got %d; want %d", n, uint64(len(timeseriesCounters))) + } + } + // Try tag filters. for i := range mns { mn := &mns[i]