constellation/coordinator/state/state_test.go
Leonard Cohnen 2d8fcd9bf4 monorepo
Co-authored-by: Malte Poll <mp@edgeless.systems>
Co-authored-by: katexochen <katexochen@users.noreply.github.com>
Co-authored-by: Daniel Weiße <dw@edgeless.systems>
Co-authored-by: Thomas Tendyck <tt@edgeless.systems>
Co-authored-by: Benedict Schlueter <bs@edgeless.systems>
Co-authored-by: leongross <leon.gross@rub.de>
Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
2022-03-22 16:09:39 +01:00

31 lines
625 B
Go

package state
import (
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
func TestState(t *testing.T) {
assert := assert.New(t)
var st State
assert.Equal(Uninitialized, st)
assert.Equal(Uninitialized, st.Get())
assert.NoError(st.Require(Uninitialized))
assert.Error(st.Require(AcceptingInit))
st.Advance(AcceptingInit)
assert.Equal(AcceptingInit, st)
assert.Equal(AcceptingInit, st.Get())
assert.Error(st.Require(Uninitialized))
assert.NoError(st.Require(AcceptingInit))
assert.Panics(func() { st.Advance(Uninitialized) })
}