mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-15 01:54:06 -08:00
fix unit test
Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>
This commit is contained in:
parent
04114aa2e6
commit
3fa636a799
|
@ -1618,7 +1618,6 @@ func TestHeadReadWriterRepair(t *testing.T) {
|
|||
opts := DefaultHeadOptions()
|
||||
opts.ChunkRange = chunkRange
|
||||
opts.ChunkDirRoot = dir
|
||||
opts.ChunkWriteQueueSize = 1 // We need to set this option so that we use the async queue. Upstream prometheus uses the queue directly.
|
||||
h, err := NewHead(nil, nil, w, opts, nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 0.0, prom_testutil.ToFloat64(h.metrics.mmapChunkCorruptionTotal))
|
||||
|
@ -1643,7 +1642,14 @@ func TestHeadReadWriterRepair(t *testing.T) {
|
|||
// take effect without another chunk being written.
|
||||
files, err := ioutil.ReadDir(mmappedChunksDir(dir))
|
||||
require.NoError(t, err)
|
||||
|
||||
// With the new chunk disk mapper we only expect 6 files, because the last call to "CutNewFile()" won't
|
||||
// take effect until the next chunk is being written.
|
||||
if opts.NewChunkDiskMapper {
|
||||
require.Equal(t, 6, len(files))
|
||||
} else {
|
||||
require.Equal(t, 7, len(files))
|
||||
}
|
||||
|
||||
// Corrupt the 4th file by writing a random byte to series ref.
|
||||
f, err := os.OpenFile(filepath.Join(mmappedChunksDir(dir), files[3].Name()), os.O_WRONLY, 0o666)
|
||||
|
|
Loading…
Reference in a new issue