mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-07-02 23:26:42 +02:00
fix test
This commit is contained in:
parent
f46eae284e
commit
b9887504e8
|
@ -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()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue