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")) }