@@ -648,6 +648,8 @@ func Test_createWorkflowPod_containerName(t *testing.T) {
648648 assert .Equal (t , common .MainContainerName , pod .Spec .Containers [1 ].Name )
649649}
650650
651+ var emissaryCmd = []string {"/var/run/argo/argoexec" , "emissary" }
652+
651653func Test_createWorkflowPod_emissary (t * testing.T ) {
652654 t .Run ("NoCommand" , func (t * testing.T ) {
653655 woc := newWoc ()
@@ -658,26 +660,23 @@ func Test_createWorkflowPod_emissary(t *testing.T) {
658660 woc := newWoc ()
659661 pod , err := woc .createWorkflowPod (context .Background (), "" , []apiv1.Container {{Command : []string {"foo" }}}, & wfv1.Template {}, & createWorkflowPodOpts {})
660662 require .NoError (t , err )
661- assert .Equal (t , []string {"/var/run/argo/argoexec" , "emissary" ,
662- "--loglevel" , getExecutorLogLevel (), "--log-format" , woc .controller .cliExecutorLogFormat ,
663- "--" , "foo" }, pod .Spec .Containers [1 ].Command )
663+ cmd := append (append (emissaryCmd , woc .getExecutorLogOpts ()... ), "--" , "foo" )
664+ assert .Equal (t , cmd , pod .Spec .Containers [1 ].Command )
664665 })
665666 t .Run ("NoCommandWithImageIndex" , func (t * testing.T ) {
666667 woc := newWoc ()
667668 pod , err := woc .createWorkflowPod (context .Background (), "" , []apiv1.Container {{Image : "my-image" }}, & wfv1.Template {}, & createWorkflowPodOpts {})
668669 require .NoError (t , err )
669- assert .Equal (t , []string {"/var/run/argo/argoexec" , "emissary" ,
670- "--loglevel" , getExecutorLogLevel (), "--log-format" , woc .controller .cliExecutorLogFormat ,
671- "--" , "my-entrypoint" }, pod .Spec .Containers [1 ].Command )
670+ cmd := append (append (emissaryCmd , woc .getExecutorLogOpts ()... ), "--" , "my-entrypoint" )
671+ assert .Equal (t , cmd , pod .Spec .Containers [1 ].Command )
672672 assert .Equal (t , []string {"my-cmd" }, pod .Spec .Containers [1 ].Args )
673673 })
674674 t .Run ("NoCommandWithArgsWithImageIndex" , func (t * testing.T ) {
675675 woc := newWoc ()
676676 pod , err := woc .createWorkflowPod (context .Background (), "" , []apiv1.Container {{Image : "my-image" , Args : []string {"foo" }}}, & wfv1.Template {}, & createWorkflowPodOpts {})
677677 require .NoError (t , err )
678- assert .Equal (t , []string {"/var/run/argo/argoexec" , "emissary" ,
679- "--loglevel" , getExecutorLogLevel (), "--log-format" , woc .controller .cliExecutorLogFormat ,
680- "--" , "my-entrypoint" }, pod .Spec .Containers [1 ].Command )
678+ cmd := append (append (emissaryCmd , woc .getExecutorLogOpts ()... ), "--" , "my-entrypoint" )
679+ assert .Equal (t , cmd , pod .Spec .Containers [1 ].Command )
681680 assert .Equal (t , []string {"foo" }, pod .Spec .Containers [1 ].Args )
682681 })
683682 t .Run ("CommandFromPodSpecPatch" , func (t * testing.T ) {
@@ -691,9 +690,8 @@ func Test_createWorkflowPod_emissary(t *testing.T) {
691690 require .NoError (t , err )
692691 pod , err := woc .createWorkflowPod (context .Background (), "" , []apiv1.Container {{Command : []string {"foo" }}}, & wfv1.Template {PodSpecPatch : string (podSpecPatch )}, & createWorkflowPodOpts {})
693692 require .NoError (t , err )
694- assert .Equal (t , []string {"/var/run/argo/argoexec" , "emissary" ,
695- "--loglevel" , getExecutorLogLevel (), "--log-format" , woc .controller .cliExecutorLogFormat ,
696- "--" , "bar" }, pod .Spec .Containers [1 ].Command )
693+ cmd := append (append (emissaryCmd , woc .getExecutorLogOpts ()... ), "--" , "bar" )
694+ assert .Equal (t , cmd , pod .Spec .Containers [1 ].Command )
697695 })
698696}
699697
@@ -747,9 +745,8 @@ func TestVolumeAndVolumeMounts(t *testing.T) {
747745 assert .Equal (t , "tmp-dir-argo" , wait .VolumeMounts [1 ].Name )
748746 assert .Equal (t , "var-run-argo" , wait .VolumeMounts [2 ].Name )
749747 main := containers [1 ]
750- assert .Equal (t , []string {"/var/run/argo/argoexec" , "emissary" ,
751- "--loglevel" , getExecutorLogLevel (), "--log-format" , woc .controller .cliExecutorLogFormat ,
752- "--" , "cowsay" }, main .Command )
748+ cmd := append (append (emissaryCmd , woc .getExecutorLogOpts ()... ), "--" , "cowsay" )
749+ assert .Equal (t , cmd , main .Command )
753750 require .Len (t , main .VolumeMounts , 2 )
754751 assert .Equal (t , "volume-name" , main .VolumeMounts [0 ].Name )
755752 assert .Equal (t , "var-run-argo" , main .VolumeMounts [1 ].Name )
0 commit comments