bug(session): Allow only valid state transitions

This commit is contained in:
Irena Rindos committed 2022-01-12 16:01:49 -05:00
1 parent f8b2e99e11
commit edae7c899f
15 files changed
+441 -11

No files matched your search

+2 -2
View File
@@ -99,7 +99,7 @@ func TestState_ImmutableFields(t *testing.T) {
_, _ = iam.TestScopes(t, iam.TestRepo(t, conn, wrapper))
session := TestDefaultSession(t, conn, wrapper, iamRepo)
state := TestState(t, conn, session.PublicId, StatusPending)
state := TestState(t, conn, session.PublicId, StatusActive)
var new State
err := rw.LookupWhere(context.Background(), &new, "session_id = ? and state = ?", []interface{}{state.SessionId, state.Status})
@@ -123,7 +123,7 @@ func TestState_ImmutableFields(t *testing.T) {
name: "status",
update: func() *State {
s := new.Clone().(*State)
s.Status = "active"
s.Status = "canceling"
return s
}(),
fieldMask: []string{"Status"},