Repository navigation
test(client): make the Encrypt deadline subtest deterministic - #842
Conversation
TestEncrypt/context_canceled expects DeadlineExceeded. slowReader waits before each byte, so with a 1s delay the first byte reached the sender at the same moment as the 1s deadline. When the sender ran first, it closed the pipe with ctx.Err(), and status.Code returned Unknown. Wait 3s before each byte, so the receiver always closes the pipe first with the DeadlineExceeded status. Signed-off-by: Nelson Parente <nelson_parente@live.com.pt> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017JhKUDV9dbs5JDz2uwZqz5
Sets the SDK version to v1.16.0-rc.1 and pins go.mod (root and examples)
to the Dapr 1.19 release candidate line:
- github.com/dapr/dapr v1.18.0 -> v1.19.0-rc.1
- github.com/dapr/kit v0.18.1 -> v0.18.4
- github.com/dapr/durabletask-go v0.12.1 -> v0.14.2-0.20260930152504-a90f95c3898d
(the pseudo-version at a90f95c3, the commit dapr v1.19.0-rc.1's own go.mod
requires; v0.14.1 does not satisfy that requirement)
- go 1.26.4 -> 1.26.6
`go mod tidy` also moves go-chi/chi, go-spiffe, otel, golang.org/x/{net,sys,text},
google.golang.org/grpc and genproto/googleapis/rpc to the minimum versions the
new dapr/dapr requirement selects. No source change.
Once Dapr 1.19.0-rc.2 is tagged, the durabletask-go line needs a second pin to
that commit's own requirement (fe0e70b7, not yet tagged as of this PR).
Supersedes #839, #840 and #841, whose changes are folded into this PR and the
two commits carried over from them:
- #840 pinned `validate_examples.yaml` to runtime 1.19.0-rc.1 (carried as-is).
- #841 added the placement/scheduler log dump on example failure (carried as-is).
- #839 bumped durabletask-go to v0.14.1; this PR pins it to the runtime's own
requirement instead, which is lower in semver but is what rc.1 actually
pins, so v0.14.1 is not used.
Verified in a worktree off origin/main (e06de53):
- `go build ./...` and `go vet ./...` clean, root and examples modules.
- `go test ./... -count=1` (root module): all packages pass, including
`client` (TestEncrypt/context_canceled, the flake #842 targets, did not
flake on this run).
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017JhKUDV9dbs5JDz2uwZqz5
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
cicoyle
left a comment
There was a problem hiding this comment.
Thanks for the PR, @nelson-parente! 🙌 Raising the slowReader delay so the first byte always arrives after the deadline removes the race in TestEncrypt/context_canceled, where the sender and receiver goroutines could each close the response pipe first and give Unknown instead of DeadlineExceeded. The description explains the race clearly, and the updated code comment and the before/after repeated runs make the change easy to trust ✨
Drafted with AI assistance and reviewed by me.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #842 +/- ##
=======================================
Coverage 56.71% 56.71%
=======================================
Files 52 52
Lines 3784 3784
=======================================
Hits 2146 2146
Misses 1483 1483
Partials 155 155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@holopin-bot @nelson-parente sdk-badge Thank you! Here's a digital badge as a small token of appreciation. |
|
Congratulations @nelson-parente, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/cmvao5p74000hjh04v4fp0694 This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
Description
TestEncrypt/context_canceledinclient/crypto_test.gois flaky. It expectscodes.DeadlineExceededbut sometimes getscodes.Unknown:It failed in the
Testjob of #839 (job log), a PR that changes onlygo.modfiles.The subtest uses a 1-second deadline and a
slowReaderthat waitsdelaybefore each byte. Withdelay: time.Second, the first byte reaches the sender goroutine at the same moment as the deadline. Then two goroutines inperformCryptoOperationcan close the response pipe first:DeadlineExceededstatus fromRecvMsgand closes the pipe with it. The test expects this error.Read, seesctx.Err() != niland closes the pipe with the plaincontext.DeadlineExceeded.status.CodereturnsUnknownfor that error.io.Pipekeeps the first error, so the result depends on which goroutine runs first.This PR sets
delay: 3 * time.Second. The first byte then arrives 2 seconds after the deadline, so the receiver always closes the pipe first. The existing comment already said that reading "should take a lot longer than 1s". The subtest still takes about 1 second, becauseio.ReadAllreturns at the deadline. The change is in the test only.Issue reference
No issue.
Checklist
Local checks (go1.26.4, macOS arm64):
go test ./client -run 'TestEncrypt/context_canceled' -count=30 -vfailed in 2 of 30 runs with the sameexpected: 0x4, actual: 0x2.TestMainruns the suite twice (TCP and unix socket), so 30 counts give 60 runs. Before, the first pass failed andTestMainstopped after 30.go test -race ./clientpasses.go vet ./clientreports no issues, andgolangci-lint run ./client/...reports the same findings with and without this change.🤖 Generated with Claude Code
https://claude.ai/code/session_017JhKUDV9dbs5JDz2uwZqz5