fix: miscellaneous build and test fixes#2534
Conversation
The TestRetryable_IncrementNonRetryableAttempt test used ptr.Ptr() which was never imported. Replace with the new() pattern already used throughout the rest of the test file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Go 1.21+ defaults GOTOOLCHAIN=auto, which can attempt toolchain version switching during xk6 dependency resolution inside Docker. GONOSUMDB=* skips GOSUM database lookups that may fail in restricted Docker network environments. Both are scoped to the build stage only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR applies small build/test fixes extracted from PR #2528 to keep the notification subscriptions branch focused, addressing a Docker build reliability issue and a failing test compilation issue.
Changes:
- Configure Go environment variables in the xk6 Docker build stage (
GOTOOLCHAIN=local,GONOSUMDB=*). - Replace an undefined
ptr.Ptrusage inretry_test.gowith a different pointer-construction approach.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| provisioning/stream/docker/k6/Dockerfile | Adds Go env configuration intended to stabilize xk6 builds in Docker environments. |
| internal/pkg/service/stream/storage/model/retry_test.go | Updates test expectations to construct *utctime.UTCTime values without ptr.Ptr. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Review Summary
This PR contains two fixes. The Dockerfile change is reasonable with a minor concern, but the test fix introduces invalid Go syntax that will fail to compile.
Critical: new(utctime.MustParse(...)) is not valid Go
The core fix in retry_test.go replaces ptr.Ptr(utctime.MustParse(...)) with new(utctime.MustParse(...)). However, new() in Go only accepts a type as its argument — not a value expression. new(utctime.MustParse("...")) will fail to compile with an error along the lines of: utctime.MustParse("...") is not a type.
The commit message references "the new() pattern already used throughout the rest of the test file" — but that pattern is equally invalid. The existing new(utctime.MustParse(...)) calls at lines 50–52, 71–73, 82–84, etc. are all compile errors inherited from PR #2528.
The correct way to take the address of a non-addressable value like a function return is to store it in a local variable first. A small test-local helper keeps things concise:
func mustParsePtr(s string) *utctime.UTCTime {
t := utctime.MustParse(s)
return &t
}Production code in retry.go already demonstrates the idiomatic approach (lines 88–93 and 105–110 use &failedAtUTC / &retryAfterUTC). The entire test file needs to be updated with one of these patterns — not just the three lines changed here.
Minor: GONOSUMDB=* disables checksum verification for all modules
Setting GONOSUMDB=* skips the Go checksum database for every module in the build stage. While this unblocks restricted Docker network environments, it means tampered or substituted modules could enter the build undetected — weakening supply-chain integrity.
A more targeted scope reduces the risk:
ENV GONOSUMDB=go.k6.io,github.com/LeonAdato,github.com/domsolutionsAlternatively, investigate whether the build network can reach sum.golang.org directly. The GOTOOLCHAIN=local change is correct and well-motivated.
Restrict GONOSUMDB to the specific module prefixes used in the k6 Docker build (go.k6.io, github.com/LeonAdato, github.com/domsolutions) instead of the wildcard *, so checksum database verification is still enforced for all other modules fetched in this build stage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
ptr.Ptrreference inretry_test.goby usingnew()insteadGOTOOLCHAIN=localandGONOSUMDB=*for xk6 Docker build to fix build issuesNotes
These are small independent fixes extracted from the notification subscriptions PR (#2528) to keep that branch focused.