github.com/profects/terraform@v0.9.0-beta1.0.20170227135739-92d4809db30d/backend/local/backend_test.go (about) 1 package local 2 3 import ( 4 "os" 5 "strings" 6 "testing" 7 8 "github.com/hashicorp/terraform/backend" 9 "github.com/hashicorp/terraform/terraform" 10 ) 11 12 func TestLocal_impl(t *testing.T) { 13 var _ backend.Enhanced = new(Local) 14 var _ backend.Local = new(Local) 15 } 16 17 func checkState(t *testing.T, path, expected string) { 18 // Read the state 19 f, err := os.Open(path) 20 if err != nil { 21 t.Fatalf("err: %s", err) 22 } 23 24 state, err := terraform.ReadState(f) 25 f.Close() 26 if err != nil { 27 t.Fatalf("err: %s", err) 28 } 29 30 actual := strings.TrimSpace(state.String()) 31 expected = strings.TrimSpace(expected) 32 if actual != expected { 33 t.Fatalf("state does not match! actual:\n%s\n\nexpected:\n%s", actual, expected) 34 } 35 }