Skip to content

Commit 7d63507

Browse files
committed
Check fo policy order in the test:
TestTransformProvider_PolicyOrderDoesNotAffectWildcardCoverage
1 parent 30be4f4 commit 7d63507

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

gateway/gateway-controller/pkg/utils/llm_transformer_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,14 +1064,9 @@ func TestTransformProvider_PolicyOrderDoesNotAffectWildcardCoverage(t *testing.T
10641064
chatOp := findOperation(result.Spec.Operations, "/chat/completions", "POST")
10651065
require.NotNil(t, chatOp)
10661066
require.NotNil(t, chatOp.Policies)
1067-
1068-
policyNames := make(map[string]bool)
1069-
for _, policy := range *chatOp.Policies {
1070-
policyNames[policy.Name] = true
1071-
}
1072-
1073-
assert.True(t, policyNames["set-headers-all"], "/chat/completions should inherit the wildcard policy")
1074-
assert.True(t, policyNames["set-headers"], "/chat/completions should keep its specific policy")
1067+
require.Len(t, *chatOp.Policies, 2)
1068+
assert.Equal(t, "set-headers-all", (*chatOp.Policies)[0].Name, "/chat/completions should apply the wildcard policy before the specific policy")
1069+
assert.Equal(t, "set-headers", (*chatOp.Policies)[1].Name, "/chat/completions should keep its specific policy after the wildcard policy")
10751070

10761071
wildcardOp := findOperation(result.Spec.Operations, "/*", "POST")
10771072
require.NotNil(t, wildcardOp)

0 commit comments

Comments
 (0)