Skip to content

test(ci): take the shared s3-test.sh that checks its fake clock - #41

Merged
slayerjain merged 1 commit into
mainfrom
train/fix/s3-test-clock-checks
Oct 24, 2026
Merged

slayerjain merged 1 commit into
mainfrom
train/fix/s3-test-clock-checks

Conversation

@slayerjain

Copy link
Copy Markdown
Member

s3.sh and s3-test.sh are meant to be one shared pair: every keploy repo that carries them pins their sha256, and a change goes into all of them together. Today the carriers other than keploy/enterprise and playwrightDB have the previous pair (the "before" column). The final pair is on keploy/enterprise's branch train/fix/s3-op-timeout-by-progress-next (46c66c5e5), which is to become keploy/enterprise#2929's head; keploy/playwrightDB#37 is to move playwrightDB to it. This PR copies the new shared s3-test.sh into keploy-ci-node byte for byte and moves the pin in .github/workflows/docker-build.yml (want_test) to its hash. s3.sh does not change.

file before after
s3.sh 40da95b471bb8e77f7851b2a32b04317b3743f3a289b730b10caf01145e8fbac unchanged
s3-test.sh bb41f8ad34ed3a4e5fc8c225214b98fedf778cc2b780074dfe44681c0580b268 a10f2713f30cc6b42c8be68c50fcce099aae5718178dbd3b7261637760b38321

What the suite now catches

  • The fake clock is checked. Two cases move it themselves: stdin that arrives 4 s late to put, and a reader that stops for 3 s on cat. Nothing checked that the clock moved. With that step a no-op, every case still passed, and so did the two s3.sh mutants those cases are there for: the first request not counted as progress, and the reader not counted as progress. Each case now checks the clock it ends at, 1004 and 1003. Neither case makes a backoff, so the value is exact.

  • S3_OP_TIMEOUT's deadline refusal is reached. FAKE_SLEEP_LATE=N makes the stub sleep end N s late, as a sleep does on a loaded box. Two new cases use it:

    • once the deadline is reached, no request is made (exit 5, one call, the clock at 1003);
    • with 1 s left, the request is still made, its connect timeout cut to 1 s.

    No case reached that refusal before. With it removed, or with its check made -ge 0, every case passed.

  • The fake clock can't be read half-written or set from outside. The clock file is written whole (a new file renamed over it), so a reader never finds it empty. FAKE_CLOCK and FAKE_SLEEP_LATE are unset before the stubs are written, so the runner's environment can't set them.

Verification

  • The commands of the "Every baked s3.sh is the shared copy" step, on this tree: exit 0.
  • s3-test.sh hermetic on an amd64 box: ALL PASS under sh and bash.
  • Failing first, on the old file (bb41f8ad, with s3.sh 40da95b4), under bash, sh, dash and busybox ash: with the two cases' own clock step a no-op, every case passes, alone and with each of the two s3.sh progress mutants; with the deadline refusal removed, or its check made -ge 0, every case passes too.
  • The new file was proven in keploy/enterprise's tree, with the same s3.sh and s3-test.sh bytes as 46c66c5e5 (the commit that is to become keploy/enterprise#2929's head, on branch train/fix/s3-op-timeout-by-progress-next; the runs were on main 591b20c16, before a rebase that changes neither file). A tick that is a no-op, one second short or one second long fails both clock cases under bash, dash and busybox ash, and so does a no-op tick with each s3.sh progress mutant. The two deadline mutants fail under bash, sh and dash.

Order

Every carrier takes this pair before keploy/enterprise#2929 merges, and keploy/enterprise#3067 tracks them. No carrier's guard reads another repo's copy, so this PR is green on its own.

s3-test.sh is the suite for s3.sh, and the pair is meant to be one
shared copy: every keploy repo that carries it pins its hashes, and a
change goes into all of them together. This moves keploy-ci-node's
s3-test.sh to the new copy and its pin to the new hash, a10f2713.
s3.sh does not change (40da95b4).

What the new copy catches that the old one did not:

- Two cases move the fake clock themselves: stdin that arrives 4 s
  late to put, and a reader that stops for 3 s on cat. Nothing checked
  that the clock moved, so with that step a no-op every case still
  passed, and so did the s3.sh mutants those cases are there for (the
  first request not counted as progress, the reader not counted as
  progress). Each case now checks the clock it ends at, 1004 and 1003.
- FAKE_SLEEP_LATE=N makes the stub sleep end N s late, as a sleep does
  on a loaded box. Two new cases use it. Once S3_OP_TIMEOUT's deadline
  is reached, no request is made (exit 5, one call). With 1 s left, the
  request is still made, its connect timeout cut to 1 s. No case
  reached s3.sh's refusal before: with it removed, or with its check
  made >= 0, every case passed.
- The fake clock file is written whole (a new file renamed over it),
  so a reader never finds it empty. FAKE_CLOCK and FAKE_SLEEP_LATE are
  unset before the stubs are written, so the runner's environment
  cannot set them.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
@slayerjain
slayerjain marked this pull request as ready for review October 24, 2026 16:42
@slayerjain
slayerjain merged commit ab7b9bc into main Oct 24, 2026
29 checks passed
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.

1 participant