Skip to content

Commit d753c06

Browse files
author
srahul3
committed
Cleanup
1 parent 8566684 commit d753c06

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

agent/consul/state/session_ce.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func validateSessionChecksTxn(tx ReadTxn, session *structs.Session) error {
152152

153153
// Verify that the check is not in critical state
154154
healthCheck := check.(*structs.HealthCheck)
155+
// we are discounting the health check for session checks since they are expected to be in critical state without session and this flow is expected to be used for session checks
155156
if healthCheck.Status == api.HealthCritical && healthCheck.Type != "session" {
156157
return fmt.Errorf("Check '%s' is in %s state", checkID, healthCheck.Status)
157158
}

agent/consul/state/session_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ func TestStateStore_Session_Invalidate_PreparedQuery_Delete(t *testing.T) {
962962
}
963963
}
964964

965+
// the goal of this test is to verify if the system is blocking the session registration when a check is in critical state.
965966
func TestHealthCheck_SessionRegistrationFail(t *testing.T) {
966967
s := testStateStore(t)
967968

@@ -1041,6 +1042,7 @@ func TestHealthCheck_SessionRegistrationAllow(t *testing.T) {
10411042
}
10421043
}
10431044

1045+
// test the session health check when session status is changed
10441046
func TestHealthCheck_Session(t *testing.T) {
10451047
s := testStateStore(t)
10461048

0 commit comments

Comments
 (0)