fix(multiplayer): bound workload credential lifetime

This commit is contained in:
Josh Creek
2026-09-03 21:27:26 +01:00
parent 8507472635
commit ea1c65acfb
12 changed files with 46 additions and 11 deletions
+6
View File
@@ -114,6 +114,12 @@ func TestAllocateRequestsAWorkloadTokenAnnotationWhenConfigured(t *testing.T) {
if claims.AllocationID != "allocation-1" {
t.Fatalf("token names allocation %q, want %q", claims.AllocationID, "allocation-1")
}
if _, err := workload.ParseSignedWorkloadToken(secret, token, now.Add(DefaultWorkloadTokenTTL-time.Second)); err != nil {
t.Fatalf("default token expired before its documented lifetime: %v", err)
}
if _, err := workload.ParseSignedWorkloadToken(secret, token, now.Add(DefaultWorkloadTokenTTL)); err == nil {
t.Fatal("default token remained valid at its exact expiry boundary")
}
gotAnnotations = nil
unsigned := Client{BaseURL: server.URL, Namespace: "games", HTTP: server.Client()}