feat: validate workload-bound result credentials

This commit is contained in:
Josh Creek
2026-08-31 21:20:12 +01:00
parent 8d1b407bb0
commit 79e66c7a95
7 changed files with 149 additions and 8 deletions
+3 -2
View File
@@ -57,12 +57,13 @@ func TestOfflineMatchmakingPipelineReachesDurableResult(t *testing.T) {
t.Fatalf("assignment = %+v err=%v", assignment, err)
}
store, err := domain.NewResultStore(domain.WorkloadBinding{Issuer: "issuer", Audience: "audience", Namespace: "games", ServiceAcct: "match-server", PodUID: "pod-1", GameServerUID: "gs-1", MatchID: allocation.MatchID, ServerID: allocation.ServerID})
binding := domain.WorkloadBinding{Issuer: "issuer", Audience: "audience", Namespace: "games", ServiceAcct: "match-server", PodUID: "pod-1", GameServerUID: "gs-1", AllocationID: allocation.AllocationID, MatchID: allocation.MatchID, ServerID: allocation.ServerID}
store, err := domain.NewResultStore(binding)
if err != nil {
t.Fatal(err)
}
result := domain.MatchResult{MatchID: allocation.MatchID, ServerID: allocation.ServerID, ResultNonce: "result-nonce-123456", Team0Score: 3, Team1Score: 2, IntegrityState: domain.IntegrityCertified}
receipt, created, err := store.Submit("result-1234567890123456", result, domain.WorkloadBinding{Issuer: "issuer", Audience: "audience", Namespace: "games", ServiceAcct: "match-server", PodUID: "pod-1", GameServerUID: "gs-1", MatchID: allocation.MatchID, ServerID: allocation.ServerID}, now)
receipt, created, err := store.Submit("result-1234567890123456", result, binding, now)
if err != nil || !created || !domain.RatingEligible(receipt) {
t.Fatalf("receipt = %+v created=%v err=%v", receipt, created, err)
}