From 0503b2675f89da4d0bc91957348bb6798c7efa26 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Mon, 28 Feb 2022 19:28:17 +0800 Subject: [PATCH] Modify according to comments. Change hook.Container's value in test case to "" Signed-off-by: Xun Jiang --- pkg/podexec/pod_command_executor_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/podexec/pod_command_executor_test.go b/pkg/podexec/pod_command_executor_test.go index d4637bf4a..addd62724 100644 --- a/pkg/podexec/pod_command_executor_test.go +++ b/pkg/podexec/pod_command_executor_test.go @@ -109,7 +109,7 @@ func TestExecutePodCommandMissingInputs(t *testing.T) { podName: "pod", hookName: "hook", hook: &v1.ExecHook{ - Container: "bar", + Container: "", }, }, } @@ -127,6 +127,7 @@ func TestExecutePodCommandMissingInputs(t *testing.T) { e := &defaultPodCommandExecutor{} err := e.ExecutePodCommand(velerotest.NewLogger(), test.item, test.podNamespace, test.podName, test.hookName, test.hook) + if hookPodContainerNotSame && test.hook.Container == pod.Spec.Containers[0].Name { assert.Error(t, fmt.Errorf("hook exec container is overwritten")) }