Skip to content

Throttling test improvements #1232

Description

@tock-ibm

1. The under-rate phase has a thin margin. submitBroadcast(t, conn, 30, 20*time.Millisecond)
paces the client at ~50/s against a 100/s limit and then asserts require.Zero(underRate.throttled).
Client-side pacing doesn't pace the limiter: the throttle check sits immediately after stream.Recv()
in the Broadcast loop, so if the Recv loop stalls for more than the burst tolerance
(burstOffset = burst*T = 100ms here) and then drains the queued envelopes at once, requests get
rejected and the assertion fails. It held for me locally at -cpu=1 and under CPU load, so this is
about CI headroom rather than a bug — but 2x on the rate plus 100ms of slack is tight for a -race
runner. Pacing at 50ms, raising Rate, or asserting a small bound instead of exactly zero would all
buy margin cheaply.

2. Two near-identical broadcast helpers now. submitBroadcast here and
submitBroadcastRequests in router_test.go. The new one is strictly better — it separates
throttled from other and asserts the status code, where the old one lumps every non-SUCCESS into
respondsErrors and regex-matches the error text. Since the four tests are being moved in this
commit anyway, that's the cheap moment to fold them onto the new helper and drop the old one.

Neither is blocking.

Originally posted by @DorKatzelnick in #1217 (review)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions