Skip to content

Commit

Permalink
fix: TestWorkflowLevelSemaphore flakiness (argoproj#3764)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarabala1979 committed Aug 13, 2020
1 parent fadd6d8 commit e9b29e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 50 deletions.
13 changes: 9 additions & 4 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,12 @@ func (s *CLISuite) TestWorkflowLevelSemaphore() {
}
}).
SubmitWorkflow().
RunCli([]string{"get", "semaphore-wf-level"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Waiting for")
RunCli([]string{"get", "semaphore-wf-level-1"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Running")
}).
WaitForWorkflowCondition(func(wf *wfv1.Workflow) bool {
return wf.Status.Phase == ""
}, "Workflow is waiting for lock", 20*time.Second).
WaitForWorkflow(30 * time.Second).
DeleteConfigMap().
Then().
Expand All @@ -985,11 +988,13 @@ func (s *CLISuite) TestTemplateLevelSemaphore() {
When().
CreateConfigMap("my-config", semaphoreData).
SubmitWorkflow().
Wait(12*time.Second).
WaitForWorkflowCondition(func(wf *wfv1.Workflow) bool {
return wf.Status.Phase == wfv1.NodeRunning
}, "waiting for Workflow to run", 10*time.Second).
RunCli([]string{"get", "semaphore-tmpl-level"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Waiting for")
}).
WaitForWorkflow(20 * time.Second).
WaitForWorkflow(30 * time.Second).
DeleteConfigMap()
}

Expand Down
46 changes: 0 additions & 46 deletions test/e2e/cli_with_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,52 +151,6 @@ func (s *CLIWithServerSuite) TestArchive() {
})
}

func (s *CLIWithServerSuite) TestWorkflowLevelSemaphore() {
semaphoreData := map[string]string{
"workflow": "1",
}
s.testNeedsOffloading()
s.Given().
Workflow("@testdata/semaphore-wf-level.yaml").
When().
CreateConfigMap("my-config", semaphoreData).
RunCli([]string{"submit", "testdata/semaphore-wf-level-1.yaml"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "semaphore-wf-level-1")
}
}).
SubmitWorkflow().
Wait(1*time.Second).
RunCli([]string{"get", "semaphore-wf-level"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Pending")
}).
WaitForWorkflow(30 * time.Second).
DeleteConfigMap().
Then().
ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
assert.Equal(t, wfv1.NodeSucceeded, status.Phase)
})
}

func (s *CLIWithServerSuite) TestTemplateLevelSemaphore() {
semaphoreData := map[string]string{
"template": "1",
}

s.testNeedsOffloading()
s.Given().
Workflow("@testdata/semaphore-tmpl-level.yaml").
When().
CreateConfigMap("my-config", semaphoreData).
SubmitWorkflow().
Wait(1*time.Second).
RunCli([]string{"get", "semaphore-tmpl-level"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Waiting for")
}).
WaitForWorkflow(20 * time.Second).
DeleteConfigMap()
}

func (s *CLIWithServerSuite) TestArgoSetOutputs() {
s.Given().
Workflow(`
Expand Down

0 comments on commit e9b29e8

Please sign in to comment.