Skip to content

Commit

Permalink
internal/upload: update test assertions to account for test build info
Browse files Browse the repository at this point in the history
Now that test build info is populated (golang/go#33976), we need to
update assertions for tests that collect counter information from the
test binary.

Fixes golang/go#69454

Change-Id: I6c7a7ee0ccd588de3d166bc903417a89fd4a0eae
Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/613275
Reviewed-by: Hongxiang Jiang <[email protected]>
Auto-Submit: Robert Findley <[email protected]>
Reviewed-by: Tim King <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
findleyr authored and gopherbot committed Sep 16, 2024
1 parent c4c42c5 commit 1b7b43a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/upload/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,21 @@ func TestRun_Basic(t *testing.T) {
t.Fatalf("got %d uploaded programs, want 1", len(got.Programs))
}
gotProgram := got.Programs[0]
wantProgram := "upload.test"
wantVersion := ""
if testenv.Go1Point() >= 24 {
// Starting with Go 1.24, debug.ReadBuildInfo reports actual package paths
// for test binaries, thanks to the fixes for #33976.
wantProgram = "golang.org/x/telemetry/internal/upload.test"
wantVersion = "devel"
}

want := telemetry.Report{
Week: got.Week, // volatile
X: got.X, // volatile
Programs: []*telemetry.ProgramReport{{
Program: "upload.test",
Version: "",
Program: wantProgram,
Version: wantVersion,
GoVersion: gotProgram.GoVersion, // easiest to read this from the report
GOOS: runtime.GOOS,
GOARCH: runtime.GOARCH,
Expand Down

0 comments on commit 1b7b43a

Please sign in to comment.