verifyRLSRequest is a test helper which listens on a channel to see if an RLS request was received by the fake RLS server. Based on whether the test expects a request to be sent out or not, it uses a different timeout.
(t *testing.T, ch chan struct{}, wantRequest bool)
| 281 | // request was received by the fake RLS server. Based on whether the test |
| 282 | // expects a request to be sent out or not, it uses a different timeout. |
| 283 | func verifyRLSRequest(t *testing.T, ch chan struct{}, wantRequest bool) { |
| 284 | t.Helper() |
| 285 | |
| 286 | if wantRequest { |
| 287 | select { |
| 288 | case <-time.After(defaultTestTimeout): |
| 289 | t.Fatalf("Timeout when waiting for an RLS request to be sent out") |
| 290 | case <-ch: |
| 291 | } |
| 292 | } else { |
| 293 | select { |
| 294 | case <-time.After(defaultTestShortTimeout): |
| 295 | case <-ch: |
| 296 | t.Fatalf("RLS request sent out when not expecting one") |
| 297 | } |
| 298 | } |
| 299 | } |
no test coverage detected