mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
simplify nesting.
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
This commit is contained in:
parent
2ae0620205
commit
457534d5c4
|
@ -772,21 +772,16 @@ func TestCancelCompactions(t *testing.T) {
|
||||||
testutil.Equals(t, 0.0, prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.ran), "initial compaction counter mismatch")
|
testutil.Equals(t, 0.0, prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.ran), "initial compaction counter mismatch")
|
||||||
db.compactc <- struct{}{} // Trigger a compaction.
|
db.compactc <- struct{}{} // Trigger a compaction.
|
||||||
var start time.Time
|
var start time.Time
|
||||||
for {
|
for prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.populatingBlocks) <= 0 {
|
||||||
if prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.populatingBlocks) > 0 {
|
|
||||||
start = time.Now()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(3 * time.Millisecond)
|
time.Sleep(3 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
start = time.Now()
|
||||||
|
|
||||||
for {
|
for prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.ran) != 1 {
|
||||||
if prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.ran) == 1 {
|
|
||||||
timeCompactionUninterrupted = time.Since(start)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(3 * time.Millisecond)
|
time.Sleep(3 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
timeCompactionUninterrupted = time.Since(start)
|
||||||
|
|
||||||
testutil.Ok(t, db.Close())
|
testutil.Ok(t, db.Close())
|
||||||
}
|
}
|
||||||
// Measure the compaction time when closing the db in the middle of compaction.
|
// Measure the compaction time when closing the db in the middle of compaction.
|
||||||
|
|
Loading…
Reference in a new issue