Files
orchard/internal/worker/fsm_test.go
T
Nikolay Edigaryev bafcf6fac2 Simplify state reconciliation and support changing Softnet settings (#364)
* Simplify state reconciliation and support changing Softnet settings

* Remove unused "updateFunc" parameter from syncOnDiskVMs()

* Don't take an address of a loop variable

* ensure → ensures

* updateVMState(): don't forget to update VMState

* Introduce TestSpecUpdateSoftnet integration test

* Update OpenAPI specification to include generation/observedGeneration
2025-11-06 20:56:31 +04:00

28 lines
743 B
Go

package worker
import (
"testing"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
"github.com/samber/mo"
"github.com/stretchr/testify/require"
)
// TestExplicitStateTransitions ensures that all state transitions
// yield a defined action (something other than ActionUndefined).
func TestExplicitStateTransitions(t *testing.T) {
possibleStates := []mo.Option[v1.VMStatus]{
mo.None[v1.VMStatus](),
mo.Some(v1.VMStatusPending),
mo.Some(v1.VMStatusRunning),
mo.Some(v1.VMStatusFailed),
}
for _, remote := range possibleStates {
for _, local := range possibleStates {
require.Positivef(t, transitions[remote][local], "state transition %s -> %s is not defined",
optionToString(remote), optionToString(local))
}
}
}