fix test
This commit is contained in:
@@ -49,6 +49,24 @@ func TestOnDisk(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 2; i < writeCount; i++ {
|
||||||
|
data := cache.GetChunk(testData[i].fileId, testData[i].size)
|
||||||
|
if bytes.Compare(data, testData[i].data) != 0 {
|
||||||
|
t.Errorf("failed to write to and read from cache: %d", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cache.Shutdown()
|
||||||
|
|
||||||
|
cache = NewTieredChunkCache(2, tmpDir, totalDiskSizeInKB, 1024)
|
||||||
|
|
||||||
|
for i := 0; i < 2; i++ {
|
||||||
|
data := cache.GetChunk(testData[i].fileId, testData[i].size)
|
||||||
|
if bytes.Compare(data, testData[i].data) == 0 {
|
||||||
|
t.Errorf("old cache should have been purged: %d", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for i := 2; i < writeCount; i++ {
|
for i := 2; i < writeCount; i++ {
|
||||||
if i == 4 {
|
if i == 4 {
|
||||||
// FIXME this failed many times on build machines
|
// FIXME this failed many times on build machines
|
||||||
@@ -77,22 +95,4 @@ func TestOnDisk(t *testing.T) {
|
|||||||
|
|
||||||
cache.Shutdown()
|
cache.Shutdown()
|
||||||
|
|
||||||
cache = NewTieredChunkCache(2, tmpDir, totalDiskSizeInKB, 1024)
|
|
||||||
|
|
||||||
for i := 0; i < 2; i++ {
|
|
||||||
data := cache.GetChunk(testData[i].fileId, testData[i].size)
|
|
||||||
if bytes.Compare(data, testData[i].data) == 0 {
|
|
||||||
t.Errorf("old cache should have been purged: %d", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 2; i < writeCount; i++ {
|
|
||||||
data := cache.GetChunk(testData[i].fileId, testData[i].size)
|
|
||||||
if bytes.Compare(data, testData[i].data) != 0 {
|
|
||||||
t.Errorf("failed to write to and read from cache: %d", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cache.Shutdown()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user