Enhance DiskFS initialization and error handling
- Updated `disk.New` to support asynchronous initialization for large caches, improving responsiveness during startup. - Introduced an eviction function parameter to `disk.New`, ensuring proper handling of over-capacity scenarios. - Enhanced error handling in various components, including memory and disk tests, to ensure robustness and clarity. - Refactored tests to validate new behaviors, including checks for delayed attachment and proper error propagation. - Removed obsolete error handling code and tests related to the now-deleted errors package, streamlining the codebase.
This commit is contained in:
Vendored
+24
-6
@@ -11,8 +11,14 @@ import (
|
||||
|
||||
func TestTieredCache_PromotionFallback(t *testing.T) {
|
||||
t.Parallel()
|
||||
fast := memory.New(1 * 1024 * 1024)
|
||||
slow := memory.New(10 * 1024 * 1024) // use mem for "disk" in test
|
||||
fast, err := memory.New(1 * 1024 * 1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
slow, err := memory.New(10 * 1024 * 1024) // use mem for "disk" in test
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
tc := New()
|
||||
tc.SetFast(fast)
|
||||
@@ -59,8 +65,14 @@ func TestTieredCache_PromotionFallback(t *testing.T) {
|
||||
|
||||
func TestTieredCache_DeleteAllTiers(t *testing.T) {
|
||||
t.Parallel()
|
||||
fast := memory.New(1024)
|
||||
slow := memory.New(1024)
|
||||
fast, err := memory.New(1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
slow, err := memory.New(1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tc := New()
|
||||
tc.SetFast(fast)
|
||||
tc.SetSlow(slow)
|
||||
@@ -80,8 +92,14 @@ func TestTieredCache_Concurrent(t *testing.T) {
|
||||
t.Skip()
|
||||
}
|
||||
t.Parallel()
|
||||
fast := memory.New(5 * 1024 * 1024)
|
||||
slow := memory.New(20 * 1024 * 1024)
|
||||
fast, err := memory.New(5 * 1024 * 1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
slow, err := memory.New(20 * 1024 * 1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tc := New()
|
||||
tc.SetFast(fast)
|
||||
tc.SetSlow(slow)
|
||||
|
||||
Reference in New Issue
Block a user