Remove plans/ directory (P0/P1/P2 work complete)

This commit is contained in:
2026-05-27 02:12:21 -05:00
parent 0c1840d223
commit 0dbb2e02ed
33 changed files with 1906 additions and 990 deletions
+47
View File
@@ -0,0 +1,47 @@
package adaptive
import (
"sync"
"testing"
"time"
)
func TestWorkloadAnalyzer_Basic(t *testing.T) {
t.Parallel()
wa := NewWorkloadAnalyzer(100 * time.Millisecond)
wa.RecordAccess("steam/depot/1", 1024)
wa.RecordAccess("steam/depot/2", 2048)
_ = wa.GetDominantPattern()
if info := wa.GetAccessInfo("steam/depot/1"); info != nil {
_ = info.AccessCount
}
wa.Stop()
}
func TestAdaptiveCacheManager_Basic(t *testing.T) {
t.Parallel()
acm := NewAdaptiveCacheManager(50 * time.Millisecond)
acm.RecordAccess("k", 100)
_ = acm.GetCurrentStrategy()
_ = acm.GetAdaptationCount()
acm.Stop()
}
// TestAdaptiveAnalyzer_UnderLoad + concurrent Record (improves 0% paths for analyzer goroutine per issue11).
func TestAdaptiveAnalyzer_UnderLoad(t *testing.T) {
t.Parallel()
wa := NewWorkloadAnalyzer(20 * time.Millisecond)
var wg sync.WaitGroup
for i := 0; i < 4; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
for j := 0; j < 30; j++ {
wa.RecordAccess("p"+string(rune('0'+id)), int64(j*100))
}
}(i)
}
wg.Wait()
_ = wa.GetDominantPattern()
wa.Stop()
}