diff --git a/test-e2e/bastion_tunnel_test.go b/test-e2e/bastion_tunnel_test.go index 71f7bb2dd..30e8ededc 100644 --- a/test-e2e/bastion_tunnel_test.go +++ b/test-e2e/bastion_tunnel_test.go @@ -54,9 +54,9 @@ func TestIzeUpInfra(t *testing.T) { t.Errorf("No success message detected after all up:\n%s", stdout) } - time.Sleep(time.Minute) - - t.Log(stdout) + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeTunnelUp(t *testing.T) { @@ -83,6 +83,10 @@ func TestIzeTunnelUp(t *testing.T) { if !strings.Contains(stdout, "Tunnel is up! Forwarded ports:") { t.Errorf("No success message detected after tunnel:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeTunnelStatus(t *testing.T) { @@ -107,6 +111,10 @@ func TestIzeTunnelStatus(t *testing.T) { if !strings.Contains(stdout, "Tunnel is up. Forwarding config:") { t.Errorf("No success message detected after tunnel status:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeTunnelDown(t *testing.T) { @@ -131,6 +139,10 @@ func TestIzeTunnelDown(t *testing.T) { if !strings.Contains(stdout, "Tunnel is down!") { t.Errorf("No success message detected after tunnel down:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeDown(t *testing.T) { @@ -155,4 +167,8 @@ func TestIzeDown(t *testing.T) { if !strings.Contains(stdout, "Destroy all completed!") { t.Errorf("No success message detected after all down:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } diff --git a/test-e2e/ecs_apps_test.go b/test-e2e/ecs_apps_test.go index 2783d1ed2..98846a17b 100644 --- a/test-e2e/ecs_apps_test.go +++ b/test-e2e/ecs_apps_test.go @@ -73,6 +73,10 @@ func TestIzeSecretsPushGoblin(t *testing.T) { if !strings.Contains(stdout, "Pushing secrets complete!") { t.Errorf("No success message detected after ize secret push:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeSecretsPushSquibby(t *testing.T) { @@ -122,6 +126,10 @@ func TestIzeSecretsPushSquibby(t *testing.T) { if !strings.Contains(stdout, "Pushing secrets complete!") { t.Errorf("No success message detected after ize secret push:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeUpInfra(t *testing.T) { @@ -157,7 +165,6 @@ func TestIzeUpInfra(t *testing.T) { if err != nil { t.Errorf("error: %s", err) - t.Log(stdout) } if stderr != "" { @@ -168,6 +175,10 @@ func TestIzeUpInfra(t *testing.T) { t.Errorf("No success message detected after ize up infra:\n%s", stdout) } + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } + time.Sleep(time.Minute) } @@ -213,6 +224,10 @@ func TestIzeUpGoblin(t *testing.T) { if !strings.Contains(stdout, "Deploy app goblin completed") { t.Errorf("No success message detected after ize up squibby:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeUpSquibby(t *testing.T) { @@ -258,6 +273,9 @@ func TestIzeUpSquibby(t *testing.T) { t.Errorf("No success message detected after ize up squibby:\n%s", stdout) } + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestCheckSecretsSquibby(t *testing.T) { @@ -278,6 +296,11 @@ func TestCheckSecretsSquibby(t *testing.T) { } + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Logf("body: \n%s", string(body)) + t.Logf("status: \n%s", string(resp.Status)) + } + if strings.Contains(string(body), exampleSquibbySecret) { return } @@ -304,6 +327,11 @@ func TestCheckSecretsGoblin(t *testing.T) { t.Error(err) } + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Logf("body: \n%s", string(body)) + t.Logf("status: \n%s", string(resp.Status)) + } + if strings.Contains(string(body), exampleGoblinSecret) { return } @@ -336,6 +364,10 @@ func TestIzeExecGoblin(t *testing.T) { if !strings.Contains(stdout, "goblin") || strings.Contains(stdout, "EOF") { t.Errorf("No success message detected after exec goblin:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeExecSquibby(t *testing.T) { @@ -360,6 +392,10 @@ func TestIzeExecSquibby(t *testing.T) { if !strings.Contains(stdout, "squibby") || strings.Contains(stdout, "EOF") { t.Errorf("No success message detected after exec squibby:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeSecretsRmGoblin(t *testing.T) { @@ -412,6 +448,10 @@ func TestIzeSecretsRmGoblin(t *testing.T) { if !strings.Contains(stdout, "Removing secrets complete!") { t.Errorf("No success message detected after ize secret push:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeSecretsRmSquibby(t *testing.T) { @@ -463,6 +503,10 @@ func TestIzeSecretsRmSquibby(t *testing.T) { if !strings.Contains(stdout, "Removing secrets complete!") { t.Errorf("No success message detected after ize secret push:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func randInt(min int, max int) int { @@ -491,4 +535,8 @@ func TestIzeDown(t *testing.T) { if !strings.Contains(stdout, "Destroy all completed!") { t.Errorf("No success message detected after down:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } diff --git a/test-e2e/terraform_test.go b/test-e2e/terraform_test.go index 9fb6f36ef..5af82c3eb 100644 --- a/test-e2e/terraform_test.go +++ b/test-e2e/terraform_test.go @@ -12,8 +12,6 @@ import ( // We're testing that we can download and run typical Terraform versions via ize func TestIzeTerraformVersion_1_0_10(t *testing.T) { - fmt.Println(os.Getenv("RUNNER_DEBUG")) - terraformVersion := "1.0.10" if examplesRootDir == "" { t.Fatalf("Missing required environment variable IZE_EXAMPLES_PATH") @@ -36,7 +34,12 @@ func TestIzeTerraformVersion_1_0_10(t *testing.T) { } else { t.Log(fmt.Sprintf("PASS: v%s: terraform version", terraformVersion)) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } + func TestIzeTerraformVersion_1_1_3(t *testing.T) { terraformVersion := "1.1.3" @@ -62,7 +65,12 @@ func TestIzeTerraformVersion_1_1_3(t *testing.T) { } else { t.Log(fmt.Sprintf("PASS: v%s: terraform version", terraformVersion)) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } + func TestIzeTerraformVersion_1_1_7(t *testing.T) { terraformVersion := "1.1.7" @@ -88,7 +96,12 @@ func TestIzeTerraformVersion_1_1_7(t *testing.T) { } else { t.Log(fmt.Sprintf("PASS: v%s: terraform version", terraformVersion)) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } + func TestIzeTerraformVersion_1_2_6(t *testing.T) { terraformVersion := "1.2.6" @@ -114,7 +127,12 @@ func TestIzeTerraformVersion_1_2_6(t *testing.T) { } else { t.Log(fmt.Sprintf("PASS: v%s: terraform version", terraformVersion)) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } + func TestIzeTerraformVersion_1_2_7(t *testing.T) { terraformVersion := "1.2.7" @@ -140,6 +158,10 @@ func TestIzeTerraformVersion_1_2_7(t *testing.T) { } else { t.Log(fmt.Sprintf("PASS: v%s: terraform version", terraformVersion)) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } } func TestIzeTerraformInit(t *testing.T) { @@ -176,4 +198,8 @@ func TestIzeTerraformInit(t *testing.T) { if !strings.Contains(stdout, "Terraform has been successfully initialized!") { t.Errorf("No success message detected after terraform init:\n%s", stdout) } + + if os.Getenv("RUNNER_DEBUG") == "1" { + t.Log(stdout) + } }