github.com/hugorut/terraform@v1.1.3/src/backend/local/hook_state_test.go (about) 1 package local 2 3 import ( 4 "testing" 5 6 "github.com/hugorut/terraform/src/states/statemgr" 7 "github.com/hugorut/terraform/src/terraform" 8 ) 9 10 func TestStateHook_impl(t *testing.T) { 11 var _ terraform.Hook = new(StateHook) 12 } 13 14 func TestStateHook(t *testing.T) { 15 is := statemgr.NewTransientInMemory(nil) 16 var hook terraform.Hook = &StateHook{StateMgr: is} 17 18 s := statemgr.TestFullInitialState() 19 action, err := hook.PostStateUpdate(s) 20 if err != nil { 21 t.Fatalf("err: %s", err) 22 } 23 if action != terraform.HookActionContinue { 24 t.Fatalf("bad: %v", action) 25 } 26 if !is.State().Equal(s) { 27 t.Fatalf("bad state: %#v", is.State()) 28 } 29 }