🐞 Ensure rate-throttling channel is empty on CI

We weren't aggressive enough to make sure our rate limiting channel was
emptied: we added only ten extra reads on the channel on our CI, which
worked perfectly on our Xeon workstation, but not on our CI.

Our MetricsBufferSize is 100, our delay is 250ms, and each query on CI
took ~25ms to complete, which meant we needed > 110 reads to exhaust the
channel, and we were on the knife's edge. So we doubled the number of
reads to 200 to make sure we had really, truly exhausted the channel's
buffers.

Fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/50>:
```
sslip.io-dns-server for more complex assertions a TXT record for an "metrics.status.sslip.io" domain is repeatedly queries [It] rate-limits the queries after some amount requests

/tmp/build/b4e0c68a/sslip.io/bosh-release/src/sslip.io-dns-server/integration_test.go:302
```
This commit is contained in:
Brian Cunnie
2022-01-24 07:19:14 -08:00
parent d42ce54947
commit 7b081f1c24

View File

@@ -303,8 +303,8 @@ var _ = Describe("sslip.io-dns-server", func() {
// typically ~9 milliseconds / query, ~125 queries / sec on 4-core Xeon
var start, stop time.Time
throttled := false
// add an extra ten to the loop to really make sure we've exhausted the buffered channel
for i := 0; i < xip.MetricsBufferSize+10; i += 1 {
// double the the number of queries to make sure we exhaust the channel
for i := 0; i < xip.MetricsBufferSize*2; i += 1 {
start = time.Now()
digArgs = "@localhost metrics.status.sslip.io txt"
digCmd = exec.Command("dig", strings.Split(digArgs, " ")...)