Merge pull request #20137 from baude/applehvenablee2e

Enable machine e2e test for applehv
This commit is contained in:
OpenShift Merge Robot
2023-09-26 07:22:14 -04:00
committed by GitHub
5 changed files with 35 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ import (
"io/fs"
"net"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
@@ -263,7 +264,7 @@ func (m *MacMachine) Init(opts machine.InitOptions) (bool, error) {
return false, err
}
// Until the disk resize can be fixed, we ignore it
logrus.Debugf("resizing disk to %d GiB", opts.DiskSize)
if err := m.resizeDisk(strongunits.GiB(opts.DiskSize)); err != nil {
return false, err
}
@@ -952,7 +953,16 @@ func (m *MacMachine) resizeDisk(newSize strongunits.GiB) error {
// error has not merged
return fmt.Errorf("invalid disk size %d: new disk must be larger than %dGB", newSize, m.DiskSize)
}
return os.Truncate(m.ImagePath.GetPath(), int64(newSize.ToBytes()))
logrus.Debugf("resizing %s to %d bytes", m.ImagePath.GetPath(), newSize.ToBytes())
// seems like os.truncate() is not very performant with really large files
// so exec'ing out to the command truncate
size := fmt.Sprintf("%dG", newSize)
c := exec.Command("truncate", "-s", size, m.ImagePath.GetPath())
if logrus.IsLevelEnabled(logrus.DebugLevel) {
c.Stderr = os.Stderr
c.Stdout = os.Stdout
}
return c.Run()
}
// isFirstBoot returns a bool reflecting if the machine has been booted before

View File

@@ -24,3 +24,16 @@ Note: Add `--focus-file "basic_test.go" ` to only run basic test
1. `./test/tools/build/ginkgo.exe -vv --tags "remote exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote" -timeout=90m --trace --no-color pkg/machine/e2e/. `
Note: Add `--focus-file "basic_test.go" ` to only run basic test
## MacOS
### Apple Hypervisor
1. `make podman-remote`
1. `make .install.ginkgo`
1. `export TMPDIR=/Users/<yourname>`
1. `export CONTAINERS_MACHINE_PROVIDER="applehv"`
1. `export MACHINE_IMAGE="https://fedorapeople.org/groups/podman/testing/applehv/arm64/fedora-coreos-38.20230925.dev.0-applehv.aarch64.raw.gz"`
1. `./test/tools/build/ginkgo -vv --tags "remote exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote" -timeout=90m --trace --no-color pkg/machine/e2e/.`
Note: Add `--focus-file "basic_test.go" ` to only run basic test

View File

@@ -0,0 +1,3 @@
package e2e_test
const podmanBinary = "../../../bin/darwin/podman"

View File

@@ -1,10 +1,3 @@
package e2e_test
import "os/exec"
const podmanBinary = "../../../bin/podman-remote"
func pgrep(n string) (string, error) {
out, err := exec.Command("pgrep", "gvproxy").Output()
return string(out), err
}

View File

@@ -3,6 +3,8 @@
package e2e_test
import (
"os/exec"
"github.com/containers/podman/v4/pkg/machine"
. "github.com/onsi/ginkgo/v2"
)
@@ -20,3 +22,8 @@ func getDownloadLocation(p machine.VirtProvider) string {
return fcd.Location
}
func pgrep(n string) (string, error) {
out, err := exec.Command("pgrep", "gvproxy").Output()
return string(out), err
}