mirror of
https://github.com/containers/podman.git
synced 2026-08-07 04:43:04 -04:00
Adjust machine CPU tests
Machine cpu default has changed to cpus/2, so adjust the tests to reflect that. Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
1 parent
96142c2f75
commit
d8e3057165
2 files changed
+15
-4
No files matched your search
@@ -2,6 +2,7 @@ package e2e_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -26,6 +27,11 @@ var _ = Describe("podman machine init", func() {
|
||||
teardown(originalHomeDir, testDir, mb)
|
||||
})
|
||||
|
||||
cpus := runtime.NumCPU() / 2
|
||||
if cpus == 0 {
|
||||
cpus = 1
|
||||
}
|
||||
|
||||
It("bad init name", func() {
|
||||
i := initMachine{}
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
@@ -42,11 +48,11 @@ var _ = Describe("podman machine init", func() {
|
||||
inspectBefore, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(BeZero())
|
||||
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
|
||||
testMachine := inspectBefore[0]
|
||||
Expect(testMachine.Name).To(Equal(mb.names[0]))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(1)))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
|
||||
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
|
||||
|
||||
})
|
||||
@@ -91,7 +97,7 @@ var _ = Describe("podman machine init", func() {
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
testMachine := inspectBefore[0]
|
||||
Expect(testMachine.Name).To(Equal(mb.names[0]))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(1)))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
|
||||
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
|
||||
Expect(testMachine.SSHConfig.RemoteUsername).To((Equal(remoteUsername)))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -89,10 +90,14 @@ var _ = Describe("podman machine set", func() {
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
ssh2 := sshMachine{}
|
||||
cpus := runtime.NumCPU() / 2
|
||||
if cpus == 0 {
|
||||
cpus = 1
|
||||
}
|
||||
sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHCommand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession2).To(Exit(0))
|
||||
Expect(sshSession2.outputToString()).To(ContainSubstring("1"))
|
||||
Expect(sshSession2.outputToString()).To(ContainSubstring(strconv.Itoa(cpus)))
|
||||
|
||||
ssh3 := sshMachine{}
|
||||
sshSession3, err := mb.setName(name).setCmd(ssh3.withSSHCommand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
|
||||
|
||||
Reference in new issue
Block a user