Skip to content

Commit

Permalink
fix: Sleep 1 second to wait for informer getting pod info. Fixes #12703
Browse files Browse the repository at this point in the history
Signed-off-by: oninowang <[email protected]>
  • Loading branch information
jswxstw authored and oninowang committed Mar 5, 2024
1 parent c81c39d commit bafcc48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workflow/controller/operator_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"testing"
"time"

"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -48,6 +49,8 @@ func TestHTTPTemplate(t *testing.T) {
pod, err = controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).UpdateStatus(ctx, pod, metav1.UpdateOptions{})
assert.Nil(t, err)
assert.Equal(t, v1.PodFailed, pod.Status.Phase)
// sleep 1 second to wait for informer getting pod info
time.Sleep(time.Second)
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowError, woc.wf.Status.Phase)
assert.Equal(t, `agent pod failed with reason:"manual termination"`, woc.wf.Status.Message)
Expand Down

0 comments on commit bafcc48

Please sign in to comment.