Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 81ced83

Browse files
dlipovetskyjimmidyson
authored andcommitted
test: Fix false negative in auditpolicy test (#16)
Other patches can change the slice length, causing the previous check to fail, although all correct patches are present.
1 parent c994e3c commit 81ced83

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/handlers/generic/mutation/auditpolicy/tests/generate_patches.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ func TestGeneratePatches(
2525
Name: "unset variable",
2626
},
2727
capitest.PatchTestDef{
28-
Name: "http proxy set for KubeadmControlPlaneTemplate",
28+
Name: "auditpolicy set for KubeadmControlPlaneTemplate",
2929
RequestItem: request.NewKubeadmControlPlaneTemplateRequestItem(""),
3030
ExpectedPatchMatchers: []capitest.JSONPatchMatcher{{
31-
Operation: "add",
32-
Path: "/spec/template/spec/kubeadmConfigSpec/files",
33-
ValueMatcher: gomega.HaveLen(1),
31+
Operation: "add",
32+
Path: "/spec/template/spec/kubeadmConfigSpec/files",
33+
ValueMatcher: gomega.ContainElements(
34+
gomega.HaveKeyWithValue(
35+
"path", "/etc/kubernetes/audit-policy/apiserver-audit-policy.yaml",
36+
),
37+
),
3438
}, {
3539
Operation: "add",
3640
Path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration",

0 commit comments

Comments
 (0)