Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fixes various tests #2874

Merged
merged 6 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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