From 1b7b43a8aaf29e66f494d5b816bc840ce24358fc Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Fri, 13 Sep 2024 19:59:00 +0000 Subject: [PATCH] internal/upload: update test assertions to account for test build info 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 Auto-Submit: Robert Findley Reviewed-by: Tim King LUCI-TryBot-Result: Go LUCI --- internal/upload/run_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/upload/run_test.go b/internal/upload/run_test.go index 4231985..3d45d77 100644 --- a/internal/upload/run_test.go +++ b/internal/upload/run_test.go @@ -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,