treewide: replace datafile pkg with rules_go/runfiles pkg
rules_go/runfiles provides the same functionality as our datafile
package. This change also contains some specifics for the now active
bzlmod, which replaces all WORKSPACE related behaviour. As example the
WORKSPACE name is now always set to _main.
Change-Id: I1a69c72b479330a627b402135670f218c297906f
Reviewed-on: https://review.monogon.dev/c/monogon/+/2745
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/installer/test/main.go b/metropolis/installer/test/main.go
index ec4f736..82efb44 100644
--- a/metropolis/installer/test/main.go
+++ b/metropolis/installer/test/main.go
@@ -30,15 +30,16 @@
"testing"
"time"
- diskfs "github.com/diskfs/go-diskfs"
+ "github.com/bazelbuild/rules_go/go/runfiles"
+ "github.com/diskfs/go-diskfs"
"github.com/diskfs/go-diskfs/disk"
"github.com/diskfs/go-diskfs/partition/gpt"
+ "source.monogon.dev/metropolis/proto/api"
+
mctl "source.monogon.dev/metropolis/cli/metroctl/core"
- "source.monogon.dev/metropolis/cli/pkg/datafile"
"source.monogon.dev/metropolis/node/build/mkimage/osimage"
"source.monogon.dev/metropolis/pkg/cmd"
- "source.monogon.dev/metropolis/proto/api"
)
// Each variable in this block points to either a test dependency or a side
@@ -123,8 +124,24 @@
func TestMain(m *testing.M) {
installerImage = filepath.Join(os.Getenv("TEST_TMPDIR"), "installer.img")
- installer := datafile.MustGet("metropolis/installer/test/kernel.efi")
- bundle := datafile.MustGet("metropolis/installer/test/testos/testos_bundle.zip")
+ installerPath, err := runfiles.Rlocation("_main/metropolis/installer/test/kernel.efi")
+ if err != nil {
+ log.Fatal(err)
+ }
+ installer, err := os.ReadFile(installerPath)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ bundlePath, err := runfiles.Rlocation("_main/metropolis/installer/test/testos/testos_bundle.zip")
+ if err != nil {
+ log.Fatal(err)
+ }
+ bundle, err := os.ReadFile(bundlePath)
+ if err != nil {
+ log.Fatal(err)
+ }
+
iargs := mctl.MakeInstallerImageArgs{
Installer: bytes.NewReader(installer),
TargetPath: installerImage,