Skip to content

Commit

Permalink
test: Fixes various tests (argoproj#2874)
Browse files Browse the repository at this point in the history
  • Loading branch information
simster7 committed Apr 28, 2020
1 parent e378ca4 commit e0ad7de
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ commands:
name: Run tests
command: |
trap 'make test-results/junit.xml' EXIT
make smoke test-e2e
make smoke test-e2e test-e2e-cron
- store_test_results:
path: test-results
when: always
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,13 @@ mysql-cli:
test-e2e: test-images cli
# Run E2E tests
@mkdir -p test-results
go test -timeout 15m -v -count 1 -p 1 ./test/e2e/... 2>&1 | tee test-results/test.out
go test -timeout 15m -v -count 1 -p 1 --short ./test/e2e/... 2>&1 | tee test-results/test.out

.PHONY: test-e2e-cron
test-e2e-cron: test-images cli
# Run E2E tests
@mkdir -p test-results
go test -timeout 4m -v -count 1 -parallel 10 -run CronSuite ./test/e2e 2>&1 | tee test-results/test.out

.PHONY: smoke
smoke: test-images
Expand Down
15 changes: 6 additions & 9 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,21 @@ func (s *CLISuite) TestRoot() {
}

func (s *CLISuite) TestWorkflowSuspendResume() {
// https://github.com/argoproj/argo/issues/2620
s.T().SkipNow()
if s.Persistence.IsEnabled() {
// Persistence is enabled for this test, but it is not enabled for the Argo Server in this test suite.
// When this is the case, this behavior is tested in cli_with_server_test.go
s.T().SkipNow()
}
s.Given().
Workflow("@testdata/sleep-3s.yaml").
When().
SubmitWorkflow().
WaitForWorkflowToStart(10*time.Second).
RunCli([]string{"suspend", "sleep-3s"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "workflow sleep-3s suspended")
}
}).
Then().
ExpectWorkflow(func(t *testing.T, _ *corev1.ObjectMeta, status *wfv1.WorkflowStatus) {
if assert.Equal(t, wfv1.NodeRunning, status.Phase) {
assert.True(t, status.AnyActiveSuspendNode())
}
}).
When().
RunCli([]string{"resume", "sleep-3s"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "workflow sleep-3s resumed")
Expand Down
28 changes: 28 additions & 0 deletions test/e2e/cli_with_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,34 @@ func (s *CLIWithServerSuite) TestWorkflowRetryPersistence() {
})
}

func (s *CLIWithServerSuite) TestWorkflowSuspendResumePersistence() {
if !s.Persistence.IsEnabled() {
// Persistence is disabled for this test, but it is enabled for the Argo Server in this test suite.
// When this is the case, this behavior is tested in cli_test.go
s.T().SkipNow()
}
s.Given().
Workflow("@testdata/sleep-3s.yaml").
When().
SubmitWorkflow().
WaitForWorkflowToStart(10*time.Second).
RunCli([]string{"suspend", "sleep-3s"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "workflow sleep-3s suspended")
}
}).
RunCli([]string{"resume", "sleep-3s"}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err) {
assert.Contains(t, output, "workflow sleep-3s resumed")
}
}).
WaitForWorkflow(20 * time.Second).
Then().
ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
assert.Equal(t, wfv1.NodeSucceeded, status.Phase)
})
}

func TestCLIWithServerSuite(t *testing.T) {
suite.Run(t, new(CLIWithServerSuite))
}
Loading

0 comments on commit e0ad7de

Please sign in to comment.