Skip to content

Commit

Permalink
Add acceptance test for apply
Browse files Browse the repository at this point in the history
  • Loading branch information
minamijoyo committed Jul 27, 2020
1 parent 3ff56af commit c049e56
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tfexec/terraform_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,28 @@ func TestTerraformCLIApply(t *testing.T) {
})
}
}

func TestAccTerraformCLIApply(t *testing.T) {
if !isAcceptanceTestEnabled() {
t.Skip("skip acceptance tests")
}

source := `resource "null_resource" "foo" {}`
e := setupTestAcc(t, source)
terraformCLI := NewTerraformCLI(e)

err := terraformCLI.Init(context.Background(), "", "-input=false", "-no-color")
if err != nil {
t.Fatalf("failed to run terraform init: %s", err)
}

plan, err := terraformCLI.Plan(context.Background(), nil, "", "-input=false", "-no-color")
if err != nil {
t.Fatalf("failed to run terraform plan: %s", err)
}

err = terraformCLI.Apply(context.Background(), plan, "", "-input=false", "-no-color")
if err != nil {
t.Fatalf("failed to run terraform apply: %s", err)
}
}

0 comments on commit c049e56

Please sign in to comment.