Skip to content

Commit

Permalink
test: Make cron test suite robust (argoproj#5453)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Behar <[email protected]>
  • Loading branch information
simster7 committed Mar 23, 2021
1 parent 9390190 commit be44ce9
Showing 1 changed file with 39 additions and 38 deletions.
77 changes: 39 additions & 38 deletions test/e2e/cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["echo hello"]`).
image: argoproj/argosay:v2`).
When().
CreateCronWorkflow().
Wait(1 * time.Minute).
Expand Down Expand Up @@ -102,10 +102,7 @@ spec:
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["echo hello"]`, scheduleInTestTimezone, testTimezone)).
image: argoproj/argosay:v2`, scheduleInTestTimezone, testTimezone)).
When().
CreateCronWorkflow().
Wait(1 * time.Minute).
Expand All @@ -128,16 +125,16 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["echo hello"]`).
image: argoproj/argosay:v2`).
When().
CreateCronWorkflow().
Then().
Expand All @@ -162,16 +159,16 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["echo hello"]`).
image: argoproj/argosay:v2`).
When().
CreateCronWorkflow().
Then().
Expand All @@ -196,16 +193,17 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["sleep 300"]`).
image: argoproj/argosay:v2
args: ["sleep", "300s"]`).
When().
CreateCronWorkflow().
Wait(2 * time.Minute).
Expand All @@ -231,16 +229,17 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["sleep 300"]`).
image: argoproj/argosay:v2
args: ["sleep", "300s"]`).
When().
CreateCronWorkflow().
Wait(2 * time.Minute).
Expand All @@ -263,16 +262,17 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 2
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["sh", -c]
args: ["sleep 300"]`).
image: argoproj/argosay:v2
args: ["sleep", "300s"]`).
When().
CreateCronWorkflow().
Wait(2*time.Minute + 20*time.Second).
Expand Down Expand Up @@ -300,19 +300,19 @@ spec:
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["python", -c]
args: ["import random; import sys; exit_code = random.choice([0]); print('exiting with code {}'.format(exit_code)); sys.exit(exit_code)"] `).
image: argoproj/argosay:v2`).
When().
CreateCronWorkflow().
Wait(2*time.Minute).
Wait(2*time.Minute+25*time.Second).
Then().
ExpectWorkflowList(listOptions, func(t *testing.T, wfList *wfv1.WorkflowList) {
assert.Equal(t, 1, len(wfList.Items))
Expand All @@ -335,19 +335,20 @@ spec:
successfulJobsHistoryLimit: 4
failedJobsHistoryLimit: 1
workflowSpec:
metadata:
labels:
workflows.argoproj.io/test: "true"
podGC:
strategy: OnPodCompletion
entrypoint: whalesay
templates:
- name: whalesay
container:
image: python:alpine3.6
imagePullPolicy: IfNotPresent
command: ["python", -c]
args: ["import random; import sys; exit_code = random.choice([1]); print('exiting with code {}'.format(exit_code)); sys.exit(exit_code)"] `).
image: argoproj/argosay:v2
args: ["exit", "1"]`).
When().
CreateCronWorkflow().
Wait(2*time.Minute+10*time.Second).
Wait(2*time.Minute+25*time.Second).
Then().
ExpectWorkflowList(listOptions, func(t *testing.T, wfList *wfv1.WorkflowList) {
assert.Equal(t, 1, len(wfList.Items))
Expand Down

0 comments on commit be44ce9

Please sign in to comment.