mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-18 14:10:54 +08:00
8K/16K profiles were treated as 32K because WindowTokens came from CompactionWindow(). They 400 and don't fail over.
29 lines
798 B
Go
29 lines
798 B
Go
package agent
|
|
|
|
import "testing"
|
|
|
|
func TestContextWindowTokensDoesNotApplyCompactionFloor(t *testing.T) {
|
|
cases := []struct {
|
|
k, wantTokens, wantCompaction int
|
|
}{
|
|
{0, 200_000, 200_000},
|
|
{-1, 200_000, 200_000},
|
|
{8, 8_000, 32_000},
|
|
{16, 16_000, 32_000},
|
|
{31, 31_000, 32_000},
|
|
{32, 32_000, 32_000},
|
|
{200, 200_000, 200_000},
|
|
{1000, 1_000_000, 1_000_000},
|
|
{2000, 1_000_000, 1_000_000},
|
|
}
|
|
for _, tc := range cases {
|
|
cfg := Config{ContextWindowK: tc.k}
|
|
if got := cfg.ContextWindowTokens(); got != tc.wantTokens {
|
|
t.Errorf("ContextWindowK=%d: ContextWindowTokens()=%d, want %d", tc.k, got, tc.wantTokens)
|
|
}
|
|
if got := cfg.CompactionWindow(); got != tc.wantCompaction {
|
|
t.Errorf("ContextWindowK=%d: CompactionWindow()=%d, want %d", tc.k, got, tc.wantCompaction)
|
|
}
|
|
}
|
|
}
|