Skip to content

Commit afb8cea

Browse files
committed
Fix inverted behavior of cancelFirstCall option
The first call was cancelled iff cancelFirstCall is false.
1 parent 4460148 commit afb8cea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/brokers/broker_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func TestIsAuthenticated(t *testing.T) {
213213
cancelFirstCall bool
214214
}{
215215
"Successfully_authenticate": {sessionID: "success"},
216-
"Successfully_authenticate_after_cancelling_first_call": {sessionID: "ia_second_call", secondCall: true},
216+
"Successfully_authenticate_after_cancelling_first_call": {sessionID: "ia_second_call", secondCall: true, cancelFirstCall: true},
217217
"Denies_authentication_when_broker_times_out": {sessionID: "ia_timeout"},
218218
"Adds_default_groups_even_if_broker_did_not_set_them": {sessionID: "ia_info_empty_groups"},
219219
"No_error_when_auth.Next_and_no_data": {sessionID: "ia_next"},
@@ -236,7 +236,7 @@ func TestIsAuthenticated(t *testing.T) {
236236
"Error_when_broker_returns_data_on_auth.Cancelled": {sessionID: "ia_cancelled_with_data"},
237237
"Error_when_broker_returns_no_data_on_auth.Denied": {sessionID: "ia_denied_without_data"},
238238
"Error_when_broker_returns_no_data_on_auth.Retry": {sessionID: "ia_retry_without_data"},
239-
"Error_when_calling_IsAuthenticated_a_second_time_without_cancelling": {sessionID: "ia_second_call", secondCall: true, cancelFirstCall: true},
239+
"Error_when_calling_IsAuthenticated_a_second_time_without_cancelling": {sessionID: "ia_second_call", secondCall: true},
240240
}
241241
for name, tc := range tests {
242242
t.Run(name, func(t *testing.T) {
@@ -264,7 +264,7 @@ func TestIsAuthenticated(t *testing.T) {
264264
time.Sleep(time.Second)
265265

266266
if tc.secondCall {
267-
if !tc.cancelFirstCall {
267+
if tc.cancelFirstCall {
268268
cancel()
269269
<-done
270270
}

0 commit comments

Comments
 (0)