test(load): add idle and tunable group scenarios
This commit is contained in:
@@ -76,6 +76,33 @@ func TestScenarioUsersScaleWithConfiguredCapacity(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReconnectBackoffCapsAndJitters(t *testing.T) {
|
||||
minWait := 2 * time.Second
|
||||
maxWait := 30 * time.Second
|
||||
first := reconnectBackoff(minWait, maxWait, 1, 10)
|
||||
if first < minWait || first >= minWait+minWait/4 {
|
||||
t.Fatalf("first backoff=%s outside expected jitter range", first)
|
||||
}
|
||||
capped := reconnectBackoff(minWait, maxWait, 10, 10)
|
||||
if capped < maxWait || capped >= maxWait+maxWait/4 {
|
||||
t.Fatalf("capped backoff=%s outside expected jitter range", capped)
|
||||
}
|
||||
if reconnectBackoff(minWait, maxWait, 3, 10) == reconnectBackoff(minWait, maxWait, 3, 11) {
|
||||
t.Fatal("different account indexes should receive different jitter")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidScenarioIncludesIdle(t *testing.T) {
|
||||
for _, scenario := range []string{"p2p", "group", "mixed", "idle"} {
|
||||
if !validScenario(scenario) {
|
||||
t.Fatalf("scenario %s should be valid", scenario)
|
||||
}
|
||||
}
|
||||
if validScenario("unknown") {
|
||||
t.Fatal("unknown scenario should be rejected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewHistoryQueryIncludesInterleavedSequenceRange(t *testing.T) {
|
||||
messages := make([]AcceptedMessage, 10)
|
||||
for i := range messages {
|
||||
|
||||
Reference in New Issue
Block a user