Skip to content

test: use modern Go testing APIs - #97

Merged
appleboy merged 1 commit into
masterfrom
refactor/modern-go-guidelines
Nov 4, 2026
Merged

appleboy merged 1 commit into
masterfrom
refactor/modern-go-guidelines

Conversation

@appleboy

@appleboy appleboy commented Nov 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Use t.Context() in timeout and response-writer tests, preserving request deadlines and concurrency assertions.

Related issues

N/A — no GitHub or Jira issue supplied.

AI authorship

  • AI was used: OpenAI Codex.
  • AI-authored files: timeout_test.go, writer_test.go.
  • Human line-by-line reviewed: None — not yet reviewed by a human.

Change classification

Leaf — tests and/or isolated examples. One reviewer recommended.

Plan reference

Apply Modern Go Guidelines for the existing Go 1.26.10 module version; preserve public APIs, dependency versions, and established behavior except the explicitly described wrapped-cache-miss logging fix.

Verification

From a checkout of 6702e0a3f8eab41b32424ae1d1c312c8034cfb3a (refactor/modern-go-guidelines), use the repository root, Go 1.26.10, and go mod download.

Command Expected result Observed
make fmt Repository formatting Passed
make lint Zero lint issues Passed
go test -race -count=1 -timeout=180s ./... Existing main, error, and boundary scenarios pass without race reports Passed on darwin/arm64
git diff --check No whitespace errors Passed
(cd _example/example01 && go test ./...) Nested module compiles and its tests pass Passed
(cd _example/example02 && go test ./...) Nested module compiles and its tests pass Passed
(cd _example/example03 && go test ./...) Nested module compiles and its tests pass Passed
(cd _example/example04 && go test ./...) Nested module compiles and its tests pass Passed

Behavioral verification

  1. Start from the branch above with the listed prerequisites.
  2. Run the test command in the table; expect all packages to pass and no race detector reports. The existing response/status, error, and boundary assertions remain in place.
  3. Review the diff for the exact substitutions listed in Summary; test contexts must remain live through request handling, and cleanup that runs after test cancellation must use an independent context.

Execution: Passed for the automated suite; human line-by-line review is pending. Tests use temporary fixtures; no production state is required.

Evidence

Web screenshots: N/A — no UI changed.

Performance: N/A — test lifecycle or example-only refactoring, with no performance claim.

Security and risk

No secrets or dependency changes in the diff. Runtime library behavior is unchanged. Revert this commit to roll back.

Reviewer guide

Review the Summary substitutions and AI-authored files above. One reviewer; check that helper arguments preserve the originating test context. Any performance evidence marked Not run remains unverified; no speed claim is made.

- Use t.Context() in timeout and response-writer tests, preserving request deadlines and concurrency assertions.
@appleboy
appleboy merged commit 4c0a91e into master Nov 4, 2026
10 checks passed
@appleboy
appleboy deleted the refactor/modern-go-guidelines branch November 4, 2026 14:08
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