From 2348e63ece91f94a37be5b72e976379f8f682700 Mon Sep 17 00:00:00 2001 From: jooho Date: Fri, 17 Nov 2023 14:13:53 -0500 Subject: [PATCH] Fix unit test for chrry-pick PR-3250 Signed-off-by: jooho --- .../admission/pod/storage_initializer_injector_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/webhook/admission/pod/storage_initializer_injector_test.go b/pkg/webhook/admission/pod/storage_initializer_injector_test.go index b0bcb865455..4e2c54c652c 100644 --- a/pkg/webhook/admission/pod/storage_initializer_injector_test.go +++ b/pkg/webhook/admission/pod/storage_initializer_injector_test.go @@ -1416,6 +1416,9 @@ func TestCaBundleSecretVolumeMount(t *testing.T) { ReadOnly: true, }, }, + SecurityContext: &v1.SecurityContext{ + RunAsUser: expectedInitContainerUid, + }, }, }, Volumes: []v1.Volume{ @@ -1485,6 +1488,9 @@ func TestCaBundleSecretVolumeMount(t *testing.T) { MountPath: constants.DefaultModelLocalMountPath, }, }, + SecurityContext: &v1.SecurityContext{ + RunAsUser: expectedInitContainerUid, + }, }, }, Volumes: []v1.Volume{ @@ -1508,7 +1514,7 @@ func TestCaBundleSecretVolumeMount(t *testing.T) { config: scenario.storageConfig, client: c, } - if err := injector.InjectStorageInitializer(scenario.original,targetNS); err != nil { + if err := injector.InjectStorageInitializer(scenario.original, targetNS); err != nil { t.Errorf("Test %q unexpected result: %s", name, err) } if diff, _ := kmp.SafeDiff(scenario.expected.Spec, scenario.original.Spec); diff != "" {