github.com/ctrox/terraform@v0.11.12-beta1/state/remote/state_test.go (about) 1 package remote 2 3 import ( 4 "sync" 5 "testing" 6 7 "github.com/hashicorp/terraform/state" 8 ) 9 10 func TestState_impl(t *testing.T) { 11 var _ state.StateReader = new(State) 12 var _ state.StateWriter = new(State) 13 var _ state.StatePersister = new(State) 14 var _ state.StateRefresher = new(State) 15 var _ state.Locker = new(State) 16 } 17 18 func TestStateRace(t *testing.T) { 19 s := &State{ 20 Client: nilClient{}, 21 } 22 23 current := state.TestStateInitial() 24 25 var wg sync.WaitGroup 26 27 for i := 0; i < 100; i++ { 28 wg.Add(1) 29 go func() { 30 defer wg.Done() 31 s.WriteState(current) 32 s.PersistState() 33 s.RefreshState() 34 }() 35 } 36 wg.Wait() 37 }