Skip to content

Commit

Permalink
core: Clean up test for issue #5254
Browse files Browse the repository at this point in the history
  • Loading branch information
phinze committed Mar 8, 2016
1 parent 2c48a7c commit 5d9637a
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions terraform/context_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,6 @@ func TestContext2Apply_issue5254(t *testing.T) {
p.DiffFn = testDiffFn

// Apply cleanly step 0
t.Log("Applying Step 0")
ctx := testContext2(t, &ContextOpts{
Module: testModule(t, "issue-5254/step-0"),
Providers: map[string]ResourceProviderFactory{
Expand All @@ -3956,16 +3955,13 @@ func TestContext2Apply_issue5254(t *testing.T) {
if err != nil {
t.Fatalf("err: %s", err)
}
t.Logf("Plan for Step 0: %s", plan)

state, err := ctx.Apply()
if err != nil {
t.Fatalf("err: %s", err)
}

// Application success. Now make the modification and store a plan
println("Planning Step 1")
t.Log("Planning Step 1")
ctx = testContext2(t, &ContextOpts{
Module: testModule(t, "issue-5254/step-1"),
State: state,
Expand All @@ -3990,11 +3986,6 @@ func TestContext2Apply_issue5254(t *testing.T) {
t.Fatalf("err: %s", err)
}

t.Logf("Plan for Step 1: %s", planFromFile)

// Apply the plan
println("Applying Step 1 (from Plan)")
t.Log("Applying Step 1 (from plan)")
ctx = planFromFile.Context(&ContextOpts{
Providers: map[string]ResourceProviderFactory{
"template": testProviderFuncFixed(p),
Expand All @@ -4006,11 +3997,21 @@ func TestContext2Apply_issue5254(t *testing.T) {
t.Fatalf("err: %s", err)
}

/*
actual := strings.TrimSpace(state.String())
expected := strings.TrimSpace(testTerraformApplyProviderAliasStr)
if actual != expected {
t.Fatalf("bad: \n%s", actual)
}
*/
actual := strings.TrimSpace(state.String())
expected := strings.TrimSpace(`
template_file.child:
ID = foo
template = Hi
type = template_file
Dependencies:
template_file.parent
template_file.parent:
ID = foo
template = Hi
type = template_file
`)
if actual != expected {
t.Fatalf("expected state: \n%s\ngot: \n%s", expected, actual)
}
}

0 comments on commit 5d9637a

Please sign in to comment.