Skip to content

Commit

Permalink
added output display when debug mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
psihachina committed Nov 2, 2022
1 parent 8deceec commit 57a289a
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 6 deletions.
22 changes: 19 additions & 3 deletions test-e2e/bastion_tunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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)
}
}
50 changes: 49 additions & 1 deletion test-e2e/ecs_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -157,7 +165,6 @@ func TestIzeUpInfra(t *testing.T) {

if err != nil {
t.Errorf("error: %s", err)
t.Log(stdout)
}

if stderr != "" {
Expand All @@ -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)
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
30 changes: 28 additions & 2 deletions test-e2e/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 57a289a

Please sign in to comment.