1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-06-30 22:31:06 +02:00
This commit is contained in:
Chris Lu 2020-09-27 23:19:50 -07:00
parent f46eae284e
commit b9887504e8

View file

@ -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++ {
if i == 4 {
// FIXME this failed many times on build machines
@ -77,22 +95,4 @@ func TestOnDisk(t *testing.T) {
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()
}