Skip to content

Commit 39561bf

Browse files
committed
cmd/coordinator: add test for trybot release-branch.go1.N branch matching
Issue golang.org/issue/28891 was that golang.org/x repo trybots were always using Go tip, even when testing release-branch.go1.N branches. It should instead be using Go version 1.N in those situations. This was fixed in CL 167382. However, that change also caused there to not be any builder coverage for golang.org/x repo branches other than "master" and "release-branch.go1.N" ones. There was no test coverage for that behavior, and we didn't really have any other branches, so no one noticed. By now, there are some golang.org/x repos that have other branches, so this was reported in issue golang.org/issue/37512. Fixing that issue is made harder because we don't have a regression test for issue 28891 yet. To make it easier to fix both of these overlapping issues without having one undo the other, start by adding a test for issue 28891. CL 227397 fixes issue 37512 and adds a test for it, so hopefully neither will regress from now on. For golang/go#28891. For golang/go#37512. Change-Id: I3475820a840a25532fb7e722c18b3d0dee3e0734 Reviewed-on: https://go-review.googlesource.com/c/build/+/227537 Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 219acbf commit 39561bf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

cmd/coordinator/coordinator_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,33 @@ func TestStagingClusterBuilders(t *testing.T) {
152152
stagingClusterBuilders()
153153
}
154154

155+
// Test that trybot on release-branch.go1.N branch of a golang.org/x repo
156+
// uses the Go revision from Go repository's release-branch.go1.N branch.
157+
// See golang.org/issue/28891.
158+
func TestIssue28891(t *testing.T) {
159+
testingKnobSkipBuilds = true
160+
161+
work := &apipb.GerritTryWorkItem{ // Roughly based on https://go-review.googlesource.com/c/tools/+/150577/1.
162+
Project: "tools",
163+
Branch: "release-branch.go1.11",
164+
ChangeId: "Ice719ab807ce3922b885a800ac873cdbf165a8f7",
165+
Commit: "9d66f1bfdbed72f546df963194a19d56180c4ce7",
166+
GoCommit: []string{"a2e79571a9d3dbe3cf10dcaeb1f9c01732219869", "e39e43d7349555501080133bb426f1ead4b3ef97", "f5ff72d62301c4e9d0a78167fab5914ca12919bd"},
167+
GoBranch: []string{"master", "release-branch.go1.11", "release-branch.go1.10"},
168+
GoVersion: []*apipb.MajorMinor{{1, 12}, {1, 11}, {1, 10}},
169+
}
170+
ts := newTrySet(work)
171+
if len(ts.builds) == 0 {
172+
t.Fatal("no builders in try set, want at least 1")
173+
}
174+
for i, bs := range ts.builds {
175+
const go111Revision = "e39e43d7349555501080133bb426f1ead4b3ef97"
176+
if bs.BuilderRev.Rev != go111Revision {
177+
t.Errorf("build[%d]: %s: x/tools on release-branch.go1.11 branch should be tested with Go 1.11, but isn't", i, bs.NameAndBranch())
178+
}
179+
}
180+
}
181+
155182
// tests that we don't test Go 1.10 for the build repo
156183
func TestNewTrySetBuildRepoGo110(t *testing.T) {
157184
testingKnobSkipBuilds = true

0 commit comments

Comments
 (0)