feat: app for testing concurrent sampling#232
Merged
Conversation
Signed-off-by: kapish <upadhyaykapish@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new sampling-test Go module intended to generate bursts of concurrent HTTP requests for validating Keploy’s --enable-sampling behavior (capture limited in-flight requests while bypassing the rest without breaking clients).
Changes:
- Introduces a minimal net/http server with
/work(delayed response) and/healthendpoints. - Adds a companion
curl.shto fire concurrent requests and verify all clients receive 2xx responses. - Documents local usage and the CI intent of the sample.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sampling-test/README.md | Documents the purpose of the sampling test app and local run steps. |
| sampling-test/main.go | Implements the minimal HTTP server with delayed /work handler for concurrency overlap. |
| sampling-test/go.mod | Adds a standalone Go module definition for the new sample. |
| sampling-test/curl.sh | Adds a concurrent curl driver script that records per-request status/body outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 21, 2026
Open
khareyash05
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a minimal
sampling-testsample app used by the new--enable-samplingend-to-end CI pipeline in keploy/keploy (#4209).The app is intentionally minimal — stdlib
net/httponly, no external dependencies, no database. Its only job is to make the Keploy proxy's sampling slot semaphore observable from the outside:GET /worksleepsHANDLER_DELAY_MS(default 500 ms) before responding. The long handler delay guarantees that a concurrent burst of curl requests overlaps inside the Keploy proxy, so the slot semaphore is genuinely contended.GET /healthis a non-sleeping readiness probe.curl.shfiresTOTAL_REQUESTS(default 20) curls in parallel via&+wait, each with--no-keepaliveso every request gets its own TCP connection. It records every response code and exits non-zero if any client saw non-2xx.With
keploy record --enable-sampling=5, the expected outcome is that 5 of the 20 requests are captured as test cases (slot count saturated) while the remaining 15 are proxied transparently without being recorded. The companion keploy workflow asserts exactly that.Files added
Links
Reproduce locally
Then under
keploy record --enable-sampling=5, you should see exactly 5get-work-*.yamltest cases under./keploy/test-set-0/tests/.Type of change
Checklist
go.modis stdlib-only)go buildpasses on Go 1.24.2curl.shis executable and passesbash -nsyntax check/healthendpoint for readiness probing