mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 20:42:03 +00:00
feat: add executable multiplayer SLO checks
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package observability
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestEvaluateSLOAcceptsHealthyWindow(t *testing.T) {
|
||||
window := SLOWindow{RegionalRTT: []time.Duration{20 * time.Millisecond, 40 * time.Millisecond}, Assignment: []time.Duration{time.Second}, Connection: []time.Duration{time.Second}, APILatency: []time.Duration{100 * time.Millisecond}, Matches: []bool{true, true, true}, Headroom: .50}
|
||||
if violations := EvaluateSLO(window); len(violations) != 0 {
|
||||
t.Fatalf("healthy window violations = %+v", violations)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvaluateSLOFlagsEveryLaunchGate(t *testing.T) {
|
||||
window := SLOWindow{RegionalRTT: []time.Duration{101 * time.Millisecond}, Assignment: []time.Duration{11 * time.Second}, Connection: []time.Duration{6 * time.Second}, APILatency: []time.Duration{251 * time.Millisecond}, Matches: []bool{true, false}, TickBacklog: true, Headroom: .29}
|
||||
violations := EvaluateSLO(window)
|
||||
if len(violations) != 7 {
|
||||
t.Fatalf("violations = %+v", violations)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvaluateSLODoesNotInventFailureForEmptyOptionalWindows(t *testing.T) {
|
||||
if violations := EvaluateSLO(SLOWindow{}); len(violations) != 0 {
|
||||
t.Fatalf("empty window violations = %+v", violations)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user