From 46c1a2177882c6e1d65a541d0621b24780e670f8 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 20:33:12 +0900 Subject: [PATCH 01/12] fix: Flaky test about lifecycle hooks Signed-off-by: toyamagu-2021 --- test/e2e/hooks_test.go | 53 ++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/test/e2e/hooks_test.go b/test/e2e/hooks_test.go index 04a4b2008d2a..5525f1dea616 100644 --- a/test/e2e/hooks_test.go +++ b/test/e2e/hooks_test.go @@ -344,36 +344,35 @@ spec: hooks: running: expression: workflow.status == "Running" - template: sleep + template: argosay-sleep-2seconds # This hook never triggered by following test. # To guarantee workflow does not wait forever for untriggered hooks. failed: expression: workflow.status == "Failed" - template: sleep + template: argosay-sleep-2seconds templates: - name: main steps: - - name: step1 - template: exit0 + template: argosay - - name: exit0 + - name: argosay container: - image: alpine:latest + image: argoproj/argosay:v2 command: ["/bin/sh", "-c"] - args: ["exit 0"] - - name: sleep + args: ["/bin/sleep 1; /argosay"] + - name: argosay-sleep-2seconds container: - image: alpine:latest + image: argoproj/argosay:v2 command: ["/bin/sh", "-c"] - args: ["/bin/sleep 2; exit 0"] + args: ["/bin/sleep 2; /argosay"] `).When(). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). Then(). ExpectWorkflow(func(t *testing.T, metadata *v1.ObjectMeta, status *v1alpha1.WorkflowStatus) { assert.Equal(t, status.Phase, v1alpha1.WorkflowSucceeded) - // TODO: This is sometimes "1/1" which might be a bug we need to investigate later. - //assert.Equal(t, status.Progress, v1alpha1.Progress("2/2")) + assert.Equal(t, status.Progress, v1alpha1.Progress("2/2")) assert.Equal(t, 1, int(status.Progress.N()/status.Progress.M())) }). ExpectWorkflowNode(func(status v1alpha1.NodeStatus) bool { @@ -396,34 +395,32 @@ spec: - name: main steps: - - name: job - template: exit0 + template: argosay hooks: running: expression: steps['job'].status == "Running" - template: hook + template: argosay-sleep-2seconds failed: expression: steps['job'].status == "Failed" - template: hook - - name: hook - script: - image: alpine:latest - command: [/bin/sh] - source: | - sleep 2 - - name: exit0 - script: - image: alpine:latest - command: [/bin/sh] - source: | - exit 0 + template: argosay-sleep-2seconds + + - name: argosay + container: + image: argoproj/argosay:v2 + command: ["/bin/sh", "-c"] + args: ["/bin/sleep 1; /argosay"] + - name: argosay-sleep-2seconds + container: + image: argoproj/argosay:v2 + command: ["/bin/sh", "-c"] + args: ["/bin/sleep 2; /argosay"] `).When(). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). Then(). ExpectWorkflow(func(t *testing.T, metadata *v1.ObjectMeta, status *v1alpha1.WorkflowStatus) { assert.Equal(t, status.Phase, v1alpha1.WorkflowSucceeded) - // TODO: This is sometimes "1/1" which might be a bug we need to investigate later. - //assert.Equal(t, status.Progress, v1alpha1.Progress("2/2")) + assert.Equal(t, status.Progress, v1alpha1.Progress("2/2")) }). ExpectWorkflowNode(func(status v1alpha1.NodeStatus) bool { return strings.Contains(status.Name, "job.hooks.running") From 3e991813585d9458d23bd5fe55538b80e92153a2 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 20:51:30 +0900 Subject: [PATCH 02/12] chore: empty commit Signed-off-by: toyamagu-2021 From 2924e2eef634436b12e5aa5d878a654d4fd7ccfa Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 21:16:26 +0900 Subject: [PATCH 03/12] chore: empty commit Signed-off-by: toyamagu-2021 From c2ba618beb8818a4ac6471f49287f062e8209e95 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 21:42:36 +0900 Subject: [PATCH 04/12] chore: empty commit Signed-off-by: toyamagu-2021 From bf47e8f55b7fac85eff46618b6549027ef7e3912 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 22:07:14 +0900 Subject: [PATCH 05/12] chore: empty commit Signed-off-by: toyamagu-2021 From f07a3cb07c80ae5b0c0e6be5f1c0cf4b5be43657 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 22:32:11 +0900 Subject: [PATCH 06/12] chore: empty commit Signed-off-by: toyamagu-2021 From bb183948a8aa3ab1f1313a9860edb076ac96ec96 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 22:39:48 +0900 Subject: [PATCH 07/12] chore: empty commit Signed-off-by: toyamagu-2021 From 34a146656b9067106bc4c081d263bbd205ed3a9e Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 22:53:19 +0900 Subject: [PATCH 08/12] chore: empty commit Signed-off-by: toyamagu-2021 From c10ad0c31fb3773facef769452d781c0f6c64d20 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 23:21:54 +0900 Subject: [PATCH 09/12] chore: empty commit Signed-off-by: toyamagu-2021 From 14f069af8307bc6c02b334b0b5126d5af6d8957e Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Sun, 6 Aug 2023 23:59:48 +0900 Subject: [PATCH 10/12] chore: commit empty Signed-off-by: toyamagu-2021 From 1ec76f7b8d34faefcd05cfcc58c73058530ba6a6 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Mon, 7 Aug 2023 22:11:06 +0900 Subject: [PATCH 11/12] fix: wait after create cm Signed-off-by: toyamagu-2021 --- test/e2e/workflow_configmap_substitution_test.go | 4 ++++ test/e2e/workflow_inputs_orverridable_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/test/e2e/workflow_configmap_substitution_test.go b/test/e2e/workflow_configmap_substitution_test.go index 2b9e7a16d5c5..7328010388fd 100644 --- a/test/e2e/workflow_configmap_substitution_test.go +++ b/test/e2e/workflow_configmap_substitution_test.go @@ -5,6 +5,7 @@ package e2e import ( "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" @@ -52,6 +53,7 @@ spec: "cmref-parameters", map[string]string{"msg": "hello world"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). @@ -95,6 +97,7 @@ spec: "cmref-parameters", map[string]string{"msg": "hello world"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). @@ -173,6 +176,7 @@ spec: "cmref-parameters", map[string]string{"msg": "hello world"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). diff --git a/test/e2e/workflow_inputs_orverridable_test.go b/test/e2e/workflow_inputs_orverridable_test.go index 6c62245c5c90..e92f72a3afb1 100644 --- a/test/e2e/workflow_inputs_orverridable_test.go +++ b/test/e2e/workflow_inputs_orverridable_test.go @@ -5,6 +5,7 @@ package e2e import ( "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" @@ -53,6 +54,7 @@ spec: "cmref-parameters", map[string]string{"cmref-key": "input-value"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). @@ -105,6 +107,7 @@ spec: "new-cmref-parameters", map[string]string{"cmref-key": "arg-value"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). @@ -188,6 +191,7 @@ spec: "cmref-parameters", map[string]string{"cmref-key": "arg-value"}, map[string]string{"workflows.argoproj.io/configmap-type": "Parameter"}). + Wait(1 * time.Second). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). DeleteConfigMap("cmref-parameters"). From 020f6cacb2aec65e127fa93647c2ce9f0c398ae6 Mon Sep 17 00:00:00 2001 From: toyamagu-2021 Date: Mon, 7 Aug 2023 22:30:31 +0900 Subject: [PATCH 12/12] fix: increase sleep time Signed-off-by: toyamagu-2021 --- test/e2e/hooks_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/hooks_test.go b/test/e2e/hooks_test.go index 5525f1dea616..8bec8e81d19f 100644 --- a/test/e2e/hooks_test.go +++ b/test/e2e/hooks_test.go @@ -459,13 +459,13 @@ spec: image: alpine:latest command: [/bin/sh] source: | - sleep 3 + sleep 4 - name: exit0 script: image: alpine:latest command: [/bin/sh] source: | - sleep 1 + sleep 2 exit 0 `).When(). SubmitWorkflow().