terraform: repro for issue 5254 test

This commit is contained in:
Paul Hinze 2016-02-24 10:04:57 -06:00
parent 4eed21f04c
commit b7554ced1d
1 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package terraform package terraform
import ( import (
"bytes"
"fmt" "fmt"
"os" "os"
"reflect" "reflect"
@ -3977,11 +3978,22 @@ func TestContext2Apply_issue5254(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
t.Logf("Plan for Step 1: %s", plan) // Write / Read plan to simulate running it through a Plan file
var buf bytes.Buffer
if err := WritePlan(plan, &buf); err != nil {
t.Fatalf("err: %s", err)
}
planFromFile, err := ReadPlan(&buf)
if err != nil {
t.Fatalf("err: %s", err)
}
t.Logf("Plan for Step 1: %s", planFromFile)
// Apply the plan // Apply the plan
t.Log("Applying Step 1 (from plan)") t.Log("Applying Step 1 (from plan)")
ctx = plan.Context(&ContextOpts{ ctx = planFromFile.Context(&ContextOpts{
Providers: map[string]ResourceProviderFactory{ Providers: map[string]ResourceProviderFactory{
"template": testProviderFuncFixed(p), "template": testProviderFuncFixed(p),
}, },