Skip to content

Commit 289e776

Browse files
committed
Ensure BOTH forwarded as well as not-forwarded requests
1 parent 3c74e96 commit 289e776

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/load_balancer_test.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func loadBalancingCursorSubtest(t *testing.T, useVst bool) {
155155

156156
// keep track of whether at least one request was forwarded internally to the
157157
// correct coordinator behind the load balancer
158-
someRequestForwarded := false
158+
someRequestsForwarded := false
159+
someRequestsNotForwarded := false
159160

160161
// Run tests for every context alternative
161162
for i, test := range tests {
@@ -189,7 +190,9 @@ func loadBalancingCursorSubtest(t *testing.T, useVst bool) {
189190
}
190191
result = append(result, doc.Elem().Interface())
191192
if wasForwarded(r) {
192-
someRequestForwarded = true
193+
someRequestsForwarded = true
194+
} else {
195+
someRequestsNotForwarded = true
193196
}
194197
time.Sleep(200 * time.Millisecond)
195198
}
@@ -214,7 +217,10 @@ func loadBalancingCursorSubtest(t *testing.T, useVst bool) {
214217
}
215218
}
216219

217-
if !someRequestForwarded {
220+
if !someRequestsForwarded {
218221
t.Error("Did not detect any request being forwarded behind load balancer!")
219222
}
223+
if !someRequestsNotForwarded {
224+
t.Error("Did not detect any request NOT being forwarded behind load balancer!")
225+
}
220226
}

0 commit comments

Comments
 (0)