diff --git a/go/runtime/bundle/helper_test.go b/go/runtime/bundle/helper_test.go deleted file mode 100644 index 00c44097597..00000000000 --- a/go/runtime/bundle/helper_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package bundle - -import ( - "path/filepath" - "slices" - - "github.com/oasisprotocol/oasis-core/go/common" - "github.com/oasisprotocol/oasis-core/go/common/version" - "github.com/oasisprotocol/oasis-core/go/runtime/bundle/component" -) - -func createSyntheticBundle(dir string, runtimeID common.Namespace, version version.Version, components []component.Kind) (string, error) { - manifest := &Manifest{ - Name: "test-runtime", - ID: runtimeID, - Components: make([]*Component, 0), - } - - for _, comp := range components { - switch comp { - case component.RONL: - manifest.Components = append(manifest.Components, &Component{ - Kind: component.RONL, - Version: version, - ELF: &ELFMetadata{ - Executable: "runtime.bin", - }, - }) - case component.ROFL: - manifest.Components = append(manifest.Components, &Component{ - Kind: component.ROFL, - Version: version, - }) - default: - } - } - - bnd := &Bundle{ - Manifest: manifest, - } - - if slices.Contains(components, component.RONL) { - if err := bnd.Add(manifest.Components[0].ELF.Executable, NewBytesData([]byte{1})); err != nil { - return "", err - } - } - - bnd.manifestHash = manifest.Hash() - path := filepath.Join(dir, bnd.GenerateFilename()) - - if err := bnd.Write(path); err != nil { - return "", err - } - - return path, nil -} diff --git a/go/runtime/bundle/registry_test.go b/go/runtime/bundle/registry_test.go index 5c4ffa0388a..18f5a37cdfd 100644 --- a/go/runtime/bundle/registry_test.go +++ b/go/runtime/bundle/registry_test.go @@ -4,6 +4,7 @@ import ( "context" "os" "path/filepath" + "slices" "strings" "testing" @@ -15,6 +16,52 @@ import ( "github.com/oasisprotocol/oasis-core/go/runtime/bundle/component" ) +func createSyntheticBundle(dir string, runtimeID common.Namespace, version version.Version, components []component.Kind) (string, error) { + manifest := &Manifest{ + Name: "test-runtime", + ID: runtimeID, + Components: make([]*Component, 0), + } + + for _, comp := range components { + switch comp { + case component.RONL: + manifest.Components = append(manifest.Components, &Component{ + Kind: component.RONL, + Version: version, + ELF: &ELFMetadata{ + Executable: "runtime.bin", + }, + }) + case component.ROFL: + manifest.Components = append(manifest.Components, &Component{ + Kind: component.ROFL, + Version: version, + }) + default: + } + } + + bnd := &Bundle{ + Manifest: manifest, + } + + if slices.Contains(components, component.RONL) { + if err := bnd.Add(manifest.Components[0].ELF.Executable, NewBytesData([]byte{1})); err != nil { + return "", err + } + } + + bnd.manifestHash = manifest.Hash() + path := filepath.Join(dir, bnd.GenerateFilename()) + + if err := bnd.Write(path); err != nil { + return "", err + } + + return path, nil +} + func TestBundleRegistry(t *testing.T) { // Prepare a temporary directory for storing bundles. dir := t.TempDir()