Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix off-by-one bug that can be caught on sub-RPS profiles #1148

Merged
merged 4 commits into from
Oct 22, 2024

Conversation

skudasov
Copy link
Collaborator

@skudasov skudasov commented Sep 20, 2024

This fixes a subtle race only when executing a low-load profile.
Added a regression test.


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes enhance the load testing framework by refining the rate limiting mechanism and improving the generator's control flow. Specifically, it introduces a flag to start tracking run status, optimizes virtual user cloning with a new rate limiting configuration, and streamlines the execution loop to better handle the load test lifecycle.

What

  • wasp/examples/scenario/vu.go
    • Updated NewExampleScenario and Clone methods to use ratelimit.New with ratelimit.WithoutSlack for more precise rate limiting.
  • wasp/wasp.go
    • Added RunStarted atomic boolean to Stats struct to track the start status of the run.
    • Renamed setupSchedule to runExecuteLoop and runSchedule to runScheduleLoop to clarify their purposes.
    • Modified runExecuteLoop and processSegment to use the new rate limiter configuration ratelimit.WithoutSlack.
    • Adjusted the pacedCall method to check if the run has started before executing, adding early returns if paused or stopped.
  • wasp/wasp_bench_test.go
    • Updated the benchmark test BenchmarkPacedCall to call runExecuteLoop instead of setupSchedule.
  • wasp/wasp_test.go
    • Adjusted tests to accommodate the new run status tracking and execution loop modifications. This includes ensuring tests wait for the appropriate conditions before assertions and modifying expectations based on the new flow.
  • New tests added to verify that requests are not duplicated at the start of the test run, ensuring that the modifications do not introduce regressions.

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube

@skudasov skudasov merged commit 37decbd into main Oct 22, 2024
37 of 41 checks passed
@skudasov skudasov deleted the wasp-ratelimit-no-slack branch October 22, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants