Fix machine tests

Catch up with regressions that have occurred since the tests were
originally written.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2022-06-30 14:08:05 -05:00
parent 6087fb2116
commit 76d887c770
6 changed files with 36 additions and 41 deletions

View File

@ -3,6 +3,7 @@ package e2e
import (
"io/ioutil"
"os"
"runtime"
"time"
"github.com/containers/podman/v4/pkg/machine"
@ -44,9 +45,9 @@ var _ = Describe("podman machine init", func() {
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
testMachine := inspectBefore[0]
Expect(testMachine.VM.Name).To(Equal(mb.names[0]))
Expect(testMachine.VM.CPUs).To(Equal(uint64(1)))
Expect(testMachine.VM.Memory).To(Equal(uint64(2048)))
Expect(testMachine.Name).To(Equal(mb.names[0]))
Expect(testMachine.Resources.CPUs).To(Equal(uint64(1)))
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
})
@ -61,7 +62,7 @@ var _ = Describe("podman machine init", func() {
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
Expect(err).To(BeNil())
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
Expect(inspectBefore[0].VM.Name).To(Equal(mb.names[0]))
Expect(inspectBefore[0].Name).To(Equal(mb.names[0]))
s := startMachine{}
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
@ -104,7 +105,15 @@ var _ = Describe("podman machine init", func() {
memorySession, err := mb.setName(name).setCmd(sshMemory.withSSHComand([]string{"cat", "/proc/meminfo", "|", "numfmt", "--field", "2", "--from-unit=Ki", "--to-unit=Mi", "|", "sed", "'s/ kB/M/g'", "|", "grep", "MemTotal"})).run()
Expect(err).To(BeNil())
Expect(memorySession).To(Exit(0))
Expect(memorySession.outputToString()).To(ContainSubstring("3824"))
switch runtime.GOOS {
// os's handle memory differently
case "linux":
Expect(memorySession.outputToString()).To(ContainSubstring("3821"))
case "darwin":
Expect(memorySession.outputToString()).To(ContainSubstring("3824"))
default:
// add windows when testing on that platform
}
sshTimezone := sshMachine{}
timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHComand([]string{"date"})).run()