Skip to content

async-config-poll: add httpPoll (long-poll) scenario#147

Merged
praagyajain merged 1 commit into
keploy:mainfrom
Aditya-eddy:async-config-poll-httppoll
Jul 16, 2026
Merged

async-config-poll: add httpPoll (long-poll) scenario#147
praagyajain merged 1 commit into
keploy:mainfrom
Aditya-eddy:async-config-poll-httppoll

Conversation

@Aditya-eddy

Copy link
Copy Markdown
Member

What

Extends the existing async-config-poll sample so it can exercise Keploy's httpPoll async-egress lane type (keploy/keploy#4368), in addition to the current periodic-poller scenario.

  • config-stub: POLL_HOLD_SECONDS (default 0) holds a watch=true request open that long before answering — a server-timeout long-poll. Default 0 preserves the current immediate behavior.
  • 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 preserves 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, so the existing periodic scenario keeps working.

Why

The keploy async_config_poll CI job (in keploy/keploy) is gaining a scenario: [periodic, httppoll] matrix so it validates the new httpPoll long-poll path end-to-end (record → kind: HttpPoll + pollDurationMs → replay held ≥ 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):

  • Record: 1 kind: HttpPoll, pollDurationMs: "5027" (~5s hold), single poll.
  • Replay: 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

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>
Copilot AI review requested due to automatic review settings July 16, 2026 14:40
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
praagyajain merged commit 4b3b4fc into keploy:main Jul 16, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ONCE gating in ConfigWatchService to run a single watch poll for the long-poll scenario.
  • Add POLL_HOLD_SECONDS to config-stub to hold watch=true requests open to simulate a server-timeout long-poll.
  • Add a separate keploy-httppoll.yml config that mirrors keploy.yml but sets the async lane type to httpPoll.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants