mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #12199 from colega/fix-test-cancel-compactions-on-windows
Fix TestCancelCompactions on windows
This commit is contained in:
commit
b8a9ced4e4
|
@ -1171,12 +1171,9 @@ func TestCancelCompactions(t *testing.T) {
|
||||||
createBlock(t, tmpdir, genSeries(1, 1, 2000, 2001)) // The most recent block is ignored so can be e small one.
|
createBlock(t, tmpdir, genSeries(1, 1, 2000, 2001)) // The most recent block is ignored so can be e small one.
|
||||||
|
|
||||||
// Copy the db so we have an exact copy to compare compaction times.
|
// Copy the db so we have an exact copy to compare compaction times.
|
||||||
tmpdirCopy := tmpdir + "Copy"
|
tmpdirCopy := t.TempDir()
|
||||||
err := fileutil.CopyDirs(tmpdir, tmpdirCopy)
|
err := fileutil.CopyDirs(tmpdir, tmpdirCopy)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
|
||||||
require.NoError(t, os.RemoveAll(tmpdirCopy))
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Measure the compaction time without interrupting it.
|
// Measure the compaction time without interrupting it.
|
||||||
var timeCompactionUninterrupted time.Duration
|
var timeCompactionUninterrupted time.Duration
|
||||||
|
@ -1228,6 +1225,7 @@ func TestCancelCompactions(t *testing.T) {
|
||||||
for i, b := range blocks {
|
for i, b := range blocks {
|
||||||
require.Falsef(t, b.Meta().Compaction.Failed, "block %d (%s) should not be marked as compaction failed", i, b.Meta().ULID)
|
require.Falsef(t, b.Meta().Compaction.Failed, "block %d (%s) should not be marked as compaction failed", i, b.Meta().ULID)
|
||||||
}
|
}
|
||||||
|
require.NoError(t, readOnlyDB.Close())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue