internal/task: add test for best-effort upgrading of remaining deps
The next CL adds the implementation.
For golang/go#73264.
Change-Id: I6425c60a535d1725c75acc20dbb6a779cd50f7a2
Reviewed-on: https://go-review.googlesource.com/c/build/+/681436
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/internal/task/tagx_test.go b/internal/task/tagx_test.go
index e980fab..d7dc99c 100644
--- a/internal/task/tagx_test.go
+++ b/internal/task/tagx_test.go
@@ -313,7 +313,25 @@
mod.Tag("v1.0.0", mod1)
tools := NewFakeRepo(t, "tools")
tools1 := tools.Commit(map[string]string{
- "go.mod": "module golang.org/x/tools\nrequire golang.org/x/mod v1.0.0\ngo 1.18\nrequire golang.org/x/sys v0.1.0\nrequire golang.org/x/build v0.0.0\n",
+ "go.mod": `module golang.org/x/tools
+
+go 1.18
+
+require (
+ // The workflow itself tags these.
+ golang.org/x/sys v0.1.0
+ golang.org/x/mod v1.0.0
+
+ // The x/build repo isn't being tagged.
+ golang.org/x/build v0.0.0
+
+ // An example of a tagx:ignore'd repo.
+ golang.org/x/net v0.21.0 // tagx:ignore
+
+ // An example of an external dependency.
+ external.example.com v0.1.0
+)
+`,
"go.sum": "\n",
"gopls/go.mod": "module golang.org/x/tools/gopls\nrequire golang.org/x/mod v1.0.0\n",
"gopls/go.sum": "\n",
@@ -368,6 +386,14 @@
if !strings.Contains(string(goMod), "sys@v0.2.0") || !strings.Contains(string(goMod), "mod@v1.0.0") {
t.Errorf("tools should use sys v0.2.0 and mod v1.0.0. go.mod: %v", string(goMod))
}
+ if strings.Contains(string(goMod), "we've upgraded to golang.org/x/build@upgrade") ||
+ strings.Contains(string(goMod), "we've upgraded to golang.org/x/net@upgrade") {
+ // TODO(go.dev/issue/73264): Make it upgrade golang.org/x dependencies, even if they're not being tagged.
+ t.Errorf("tools should not have upgraded x/build and x/net: %v", string(goMod))
+ }
+ if strings.Contains(string(goMod), "we've upgraded to external.example.com") {
+ t.Errorf("tools should not have upgraded external.example.com: %v", string(goMod))
+ }
if !strings.Contains(string(goMod), "tidied!") {
t.Error("tools go.mod should be tidied")
}