Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integration tests with Bazel@HEAD #3781

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/core/transition/hermeticity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/gopackagesdriver/gopackagesdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -122,16 +123,16 @@ 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
}
})

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
}
}
Expand Down
Loading