Skip to content

Commit

Permalink
Fix integration tests with Bazel@HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Dec 11, 2023
1 parent 43e644e commit 2bdb5f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/core/transition/hermeticity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import (
func TestMain(m *testing.M) {
bazel_testing.TestMain(m, bazel_testing.Args{
Main: `
-- .bazelrc --
# bazel config breaks when the lockfile is updated after a command.
common --lockfile_mode=off
-- MODULE.bazel --
-- BUILD.bazel --
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
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

0 comments on commit 2bdb5f6

Please sign in to comment.