diff --git a/tests/core/transition/hermeticity_test.go b/tests/core/transition/hermeticity_test.go index 2e427e02a0..3650ce16b6 100644 --- a/tests/core/transition/hermeticity_test.go +++ b/tests/core/transition/hermeticity_test.go @@ -195,6 +195,12 @@ func TestGoProtoLibraryToolAttrsAreReset(t *testing.T) { } func assertDependsCleanlyOnWithFlags(t *testing.T, targetA, targetB string, flags ...string) { + // Analyze the targets to ensure that MODULE.bazel.lock has been created, otherwise bazel config + // will fail after the cquery command due to the Skyframe invalidation caused by a changed file. + err := bazel_testing.RunBazel(append([]string{"build", targetA, targetB, "--nobuild"}, flags...)...) + if err != nil { + t.Fatalf("bazel build %s %s: %v", targetA, targetB, err) + } query := fmt.Sprintf("deps(%s) intersect %s", targetA, targetB) out, err := bazel_testing.BazelOutput(append( []string{ diff --git a/tests/integration/gopackagesdriver/gopackagesdriver_test.go b/tests/integration/gopackagesdriver/gopackagesdriver_test.go index 86c93a4d2b..b17a3325c3 100644 --- a/tests/integration/gopackagesdriver/gopackagesdriver_test.go +++ b/tests/integration/gopackagesdriver/gopackagesdriver_test.go @@ -64,7 +64,8 @@ func TestHelloExternal(t *testing.T) {} } const ( - osPkgID = "@io_bazel_rules_go//stdlib:os" + osPkgID = "@io_bazel_rules_go//stdlib:os" + bzlmodOsPkgID = "@@io_bazel_rules_go//stdlib:os" ) func TestBaseFileLookup(t *testing.T) { @@ -122,8 +123,8 @@ func TestBaseFileLookup(t *testing.T) { return } - if pkg.Imports["os"] != osPkgID { - t.Errorf("Expected os import to map to %q:\n%+v", osPkgID, pkg) + if pkg.Imports["os"] != osPkgID && pkg.Imports["os"] != bzlmodOsPkgID { + t.Errorf("Expected os import to map to %q or %q:\n%+v", osPkgID, bzlmodOsPkgID, pkg) return } }) @@ -131,7 +132,7 @@ func TestBaseFileLookup(t *testing.T) { t.Run("dependency", func(t *testing.T) { var osPkg *gpd.FlatPackage for _, p := range resp.Packages { - if p.ID == osPkgID { + if p.ID == osPkgID || p.ID == bzlmodOsPkgID { osPkg = p } }