Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
Signed-off-by: shuangkun <tsk2013uestc@163.com>
  • Loading branch information
shuangkun committed Apr 6, 2024
1 parent 05025d2 commit 47ff6c6
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 370 deletions.
38 changes: 0 additions & 38 deletions test/e2e/argo_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1572,44 +1572,6 @@ func (s *ArgoServerSuite) TestRetryStoppedButIncompleteWorkflow() {
})
}

func (s *ArgoServerSuite) TestRetryWorkflowWithContinueOn() {
var workflowName string
s.Given().
Workflow(`@testdata/retry-workflow-with-continueon.yaml`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeFailed).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, 6, len(status.Nodes))
})

s.Run("Retry", func() {
s.e().PUT("/api/v1/workflows/argo/{workflowName}/retry", workflowName).
Expect().
Status(200).
JSON().
Path("$.metadata.name").
NotNull()
})

s.Given().
When().
WaitForWorkflow(fixtures.ToBeCompleted).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, wfv1.WorkflowFailed, status.Phase)
assert.Equal(t, 6, len(status.Nodes))
}).
ExpectWorkflowNode(func(status wfv1.NodeStatus) bool {
return strings.Contains(status.Name, "retry-workflow-with-continueon.success")
}, func(t *testing.T, status *wfv1.NodeStatus, pod *corev1.Pod) {
assert.Equal(t, 2, len(status.Children))
})
}

func (s *ArgoServerSuite) TestWorkflowTemplateService() {
s.Run("Lint", func() {
s.e().POST("/api/v1/workflow-templates/argo/lint").
Expand Down
36 changes: 36 additions & 0 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/yaml"
Expand Down Expand Up @@ -913,6 +914,41 @@ func (s *CLISuite) TestWorkflowRetryWithRecreatedPVC() {
})
}

func (s *CLISuite) TestRetryWorkflowWithContinueOn() {
var workflowName string
s.Given().
Workflow(`@testdata/retry-workflow-with-continueon.yaml`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeFailed).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, 6, len(status.Nodes))
}).
RunCli([]string{"retry", workflowName}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err, output) {
assert.Contains(t, output, "Name:")
assert.Contains(t, output, "Namespace:")
}
})

s.Given().
When().
WaitForWorkflow(fixtures.ToBeCompleted).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, wfv1.WorkflowFailed, status.Phase)
assert.Equal(t, 6, len(status.Nodes))
}).
ExpectWorkflowNode(func(status wfv1.NodeStatus) bool {
return strings.Contains(status.Name, "retry-workflow-with-continueon.success")
}, func(t *testing.T, status *wfv1.NodeStatus, pod *corev1.Pod) {
assert.Equal(t, 2, len(status.Children))
})
}

func (s *CLISuite) TestWorkflowStop() {
s.Given().
Workflow("@smoke/basic.yaml").
Expand Down
Loading

0 comments on commit 47ff6c6

Please sign in to comment.