30 lines
639 B
Go
30 lines
639 B
Go
package local
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/internal/states/statemgr"
|
|
"github.com/hashicorp/terraform/internal/terraform"
|
|
)
|
|
|
|
func TestStateHook_impl(t *testing.T) {
|
|
var _ terraform.Hook = new(StateHook)
|
|
}
|
|
|
|
func TestStateHook(t *testing.T) {
|
|
is := statemgr.NewTransientInMemory(nil)
|
|
var hook terraform.Hook = &StateHook{StateMgr: is}
|
|
|
|
s := statemgr.TestFullInitialState()
|
|
action, err := hook.PostStateUpdate(s)
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
if action != terraform.HookActionContinue {
|
|
t.Fatalf("bad: %v", action)
|
|
}
|
|
if !is.State().Equal(s) {
|
|
t.Fatalf("bad state: %#v", is.State())
|
|
}
|
|
}
|