pkg/machine/e2e: run debug commands after init

To debug the slow machine init command. Let's see the disk image size.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-07-05 14:19:23 +02:00
parent ada4e1a8c1
commit 527c0f0bfa
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 26 additions and 1 deletions

View File

@ -49,6 +49,7 @@ type machineTestBuilder struct {
names []string
podmanBinary string
timeout time.Duration
isInit bool
}
// waitWithTimeout waits for a command to complete for a given
@ -139,6 +140,10 @@ func (m *machineTestBuilder) setCmd(mc machineCommand) *machineTestBuilder {
m.names = append(m.names, m.name)
}
m.cmd = mc.buildCmd(m)
_, ok := mc.(*initMachine)
m.isInit = ok
return m
}
@ -166,7 +171,27 @@ func (m *machineTestBuilder) runWithoutWait() (*machineSession, error) {
}
func (m *machineTestBuilder) run() (*machineSession, error) {
return runWrapper(m.podmanBinary, m.cmd, m.timeout, true)
s, err := runWrapper(m.podmanBinary, m.cmd, m.timeout, true)
if m.isInit {
c := exec.Command("du", "-ah", filepath.Join(os.Getenv("HOME"), ".local/share/containers/podman/machine/applehv"))
c.Stderr = os.Stderr
c.Stdout = os.Stdout
GinkgoWriter.Println(c.Args)
_ = c.Run()
c = exec.Command("ls", "-lh", filepath.Join(os.Getenv("HOME"), ".local/share/containers/podman/machine/applehv"))
c.Stderr = os.Stderr
c.Stdout = os.Stdout
GinkgoWriter.Println(c.Args)
_ = c.Run()
c = exec.Command("stat", filepath.Join(os.Getenv("HOME"), ".local/share/containers/podman/machine/applehv", m.name+"-arm64.raw"))
c.Stderr = os.Stderr
c.Stdout = os.Stdout
GinkgoWriter.Println(c.Args)
_ = c.Run()
}
return s, err
}
func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {