Skip to content

fix: miscellaneous build and test fixes#2534

Merged
Matovidlo merged 3 commits intomainfrom
mvasko/fix-gotoolchain-and-retry-test
Mar 2, 2026
Merged

fix: miscellaneous build and test fixes#2534
Matovidlo merged 3 commits intomainfrom
mvasko/fix-gotoolchain-and-retry-test

Conversation

@Matovidlo
Copy link
Copy Markdown
Contributor

Summary

  • Fix undefined ptr.Ptr reference in retry_test.go by using new() instead
  • Set GOTOOLCHAIN=local and GONOSUMDB=* for xk6 Docker build to fix build issues

Notes

These are small independent fixes extracted from the notification subscriptions PR (#2528) to keep that branch focused.

Matovidlo and others added 2 commits March 1, 2026 11:50
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Ptr usage in retry_test.go with 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.

Comment thread internal/pkg/service/stream/storage/model/retry_test.go
Comment thread internal/pkg/service/stream/storage/model/retry_test.go
Comment thread internal/pkg/service/stream/storage/model/retry_test.go
Comment thread provisioning/stream/docker/k6/Dockerfile
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

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/domsolutions

Alternatively, investigate whether the build network can reach sum.golang.org directly. The GOTOOLCHAIN=local change is correct and well-motivated.

Comment thread internal/pkg/service/stream/storage/model/retry_test.go
Comment thread provisioning/stream/docker/k6/Dockerfile Outdated
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>
@Matovidlo Matovidlo marked this pull request as ready for review March 1, 2026 12:09
Copy link
Copy Markdown
Contributor

@hosekpeter hosekpeter left a comment

Choose a reason for hiding this comment

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

lgtm

@Matovidlo Matovidlo merged commit e6741c5 into main Mar 2, 2026
42 of 44 checks passed
@Matovidlo Matovidlo deleted the mvasko/fix-gotoolchain-and-retry-test branch March 2, 2026 08:20
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.

4 participants