terraform/state/remote/state_test.go

38 lines
616 B
Go
Raw Normal View History

2015-02-21 20:52:55 +01:00
package remote
import (
2017-05-25 17:01:25 +02:00
"sync"
2015-02-21 20:52:55 +01:00
"testing"
"github.com/hashicorp/terraform/state"
)
func TestState_impl(t *testing.T) {
var _ state.StateReader = new(State)
var _ state.StateWriter = new(State)
var _ state.StatePersister = new(State)
var _ state.StateRefresher = new(State)
var _ state.Locker = new(State)
2015-02-21 20:52:55 +01:00
}
2017-05-25 17:01:25 +02:00
func TestStateRace(t *testing.T) {
s := &State{
Client: nilClient{},
}
current := state.TestStateInitial()
var wg sync.WaitGroup
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
defer wg.Done()
s.WriteState(current)
s.PersistState()
s.RefreshState()
}()
}
wg.Wait()
}