async-config-poll: add httpPoll (long-poll) scenario#147
Merged
Conversation
Extends the sample so it can exercise Keploy's httpPoll async-egress lane type (keploy#4368), not just the periodic poller: - config-stub: POLL_HOLD_SECONDS (default 0) holds a watch=true request open that long before answering — a server-timeout long-poll. Default 0 keeps the current immediate behavior for the periodic scenario. - ConfigWatchService: WATCH_ONCE (default off) opens exactly one watch poll then stops the daemon, so the recording holds a single long poll rather than a stream. Default off keeps the current infinite poller. - keploy-httppoll.yml: same lane as keploy.yml but type: httpPoll, so the poll is recorded as kind:HttpPoll with an open-duration (pollDurationMs) and held until its resolve testcase at replay. All additions are env-gated and backward compatible; the default run is unchanged. Signed-off-by: Aditya Sharma <aditya282003@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Aditya-eddy
added a commit
to keploy/keploy
that referenced
this pull request
Jul 16, 2026
Adds a scenario: [periodic, httppoll] axis to the async_config_poll job so the async-egress e2e validates the new httpPoll long-poll lane type, not just the periodic poller: - periodic (unchanged): fast poller, stub answers immediately, lane type http -> asserts the engine SERVED the polls (served >= 1, no drift). - httppoll: one WATCH_ONCE poll held open by the stub (POLL_HOLD_SECONDS), lane type httpPoll (keploy-httppoll.yml) -> asserts the poll is recorded as kind:HttpPoll with a pollDurationMs, and that at replay the engine HELD it until its resolve testcase (held >= 1). The >60s hang-watchdog exemption is unit-tested (supervisor); this e2e uses a short hold for speed. TEMP: the samples-java checkout is pinned to the fork branch (Aditya-eddy/samples-java async-config-poll-httppoll) because the sample changes are in keploy/samples-java#147, not yet on main. REVERT the checkout to keploy/samples-java (main) once #147 merges. Signed-off-by: Aditya Sharma <aditya282003@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
praagyajain
approved these changes
Jul 16, 2026
There was a problem hiding this comment.
Pull request overview
Extends the async-config-poll sample with an env-gated “httpPoll / long-poll” scenario so Keploy can record/replay the config-watch egress as an HttpPoll (capturing pollDurationMs) in addition to the existing periodic polling behavior.
Changes:
- Add
WATCH_ONCEgating inConfigWatchServiceto run a single watch poll for the long-poll scenario. - Add
POLL_HOLD_SECONDStoconfig-stubto holdwatch=truerequests open to simulate a server-timeout long-poll. - Add a separate
keploy-httppoll.ymlconfig that mirrorskeploy.ymlbut sets the async lane type tohttpPoll.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| async-config-poll/src/main/java/com/example/asyncconfig/config/ConfigWatchService.java | Adds WATCH_ONCE behavior to stop after a single watch poll for the httpPoll scenario. |
| async-config-poll/keploy-httppoll.yml | Introduces a Keploy config variant using type: httpPoll for the config-watch async lane. |
| async-config-poll/config-stub/main.go | Adds a configurable long-poll hold (POLL_HOLD_SECONDS) for watch=true requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+96
to
+98
| if (watchOnce) { | ||
| break; // single long-poll connection for the httpPoll scenario | ||
| } |
Comment on lines
+48
to
+56
| if hold > 0 { | ||
| // Long-poll: hold the connection open until the server timeout, | ||
| // then deliver the next version. Abort if the client disconnects. | ||
| select { | ||
| case <-time.After(hold): | ||
| case <-r.Context().Done(): | ||
| return | ||
| } | ||
| } |
Aditya-eddy
added a commit
to keploy/keploy
that referenced
this pull request
Jul 17, 2026
keploy/samples-java#147 (the async-config-poll httpPoll sample hooks) is merged to main, so the async_config_poll job no longer needs the temporary fork-branch pin. Restore the checkout to keploy/samples-java (main). Signed-off-by: Aditya Sharma <aditya282003@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Extends the existing async-config-poll sample so it can exercise Keploy's
httpPollasync-egress lane type (keploy/keploy#4368), in addition to the current periodic-poller scenario.POLL_HOLD_SECONDS(default0) holds awatch=truerequest open that long before answering — a server-timeout long-poll. Default0preserves the current immediate behavior.WATCH_ONCE(default off) opens exactly one watch poll then stops the daemon, so the recording holds a single long poll rather than a stream. Default off preserves the current infinite poller.keploy.ymlbuttype: httpPoll, so the poll is recorded askind: HttpPollwith an open-duration (pollDurationMs) and held until its resolve testcase at replay.All additions are env-gated and backward compatible — the default run is unchanged, so the existing periodic scenario keeps working.
Why
The keploy
async_config_pollCI job (in keploy/keploy) is gaining ascenario: [periodic, httppoll]matrix so it validates the newhttpPolllong-poll path end-to-end (record →kind: HttpPoll+pollDurationMs→ replayheld ≥ 1). That job needs these sample hooks. The matching keploy/keploy change is on PR #4368.Validated
Locally against this sample (jdk8 + MySQL + config-stub, keploy built from keploy#4368):
1 kind: HttpPoll,pollDurationMs: "5027"(~5s hold), single poll.test exit 0, all tests PASSED, async egress verdict{served: 1, held: 1, shape_flags: 0}.🤖 Generated with Claude Code
Signed-off-by: Aditya Sharma aditya282003@gmail.com