From b2131e4a06036ec73a6f6d6ba93a168a2f8ccfef Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Mon, 8 Jul 2019 17:24:59 -0700 Subject: [PATCH] Attempts to fix flaky TestCustomToolWithEnv (#1876) (#1893) --- test/e2e/custom_tool_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/e2e/custom_tool_test.go b/test/e2e/custom_tool_test.go index 30cb52ff86..c52390e5a8 100644 --- a/test/e2e/custom_tool_test.go +++ b/test/e2e/custom_tool_test.go @@ -2,6 +2,7 @@ package e2e import ( "testing" + "time" "github.com/stretchr/testify/assert" @@ -60,7 +61,7 @@ func TestCustomToolWithEnv(t *testing.T) { Name: Name(), Generate: Command{ Command: []string{"sh", "-c"}, - Args: []string{`echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$FOO\"}}}"`}, + Args: []string{`echo "{\"kind\": \"ConfigMap\", \"apiVersion\": \"v1\", \"metadata\": { \"name\": \"$ARGOCD_APP_NAME\", \"namespace\": \"$ARGOCD_APP_NAMESPACE\", \"annotations\": {\"Foo\": \"$FOO\", \"Bar\": \"baz\"}}}"`}, }, }, ). @@ -74,6 +75,14 @@ func TestCustomToolWithEnv(t *testing.T) { Expect(OperationPhaseIs(OperationSucceeded)). Expect(SyncStatusIs(SyncStatusCodeSynced)). Expect(HealthIs(HealthStatusHealthy)). + And(func(app *Application) { + time.Sleep(1 * time.Second) + }). + And(func(app *Application) { + output, err := Run("", "kubectl", "-n", DeploymentNamespace(), "get", "cm", Name(), "-o", "jsonpath={.metadata.annotations.Bar}") + assert.NoError(t, err) + assert.Equal(t, "baz", output) + }). And(func(app *Application) { output, err := Run("", "kubectl", "-n", DeploymentNamespace(), "get", "cm", Name(), "-o", "jsonpath={.metadata.annotations.Foo}") assert.NoError(t, err)