Skip to content

Commit 71b3d77

Browse files
Merge pull request #20158 from baude/wslenableinit
wsl: enable machine init tests
2 parents 94139ec + 0d4526e commit 71b3d77

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pkg/machine/e2e/init_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ var _ = Describe("podman machine init", func() {
5252

5353
testMachine := inspectBefore[0]
5454
Expect(testMachine.Name).To(Equal(mb.names[0]))
55-
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
56-
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
57-
55+
if testProvider.VMType() != machine.WSLVirt { // WSL hardware specs are hardcoded
56+
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
57+
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
58+
}
5859
})
5960

6061
It("simple init with start", func() {
@@ -97,13 +98,16 @@ var _ = Describe("podman machine init", func() {
9798
Expect(inspectBefore).ToNot(BeEmpty())
9899
testMachine := inspectBefore[0]
99100
Expect(testMachine.Name).To(Equal(mb.names[0]))
100-
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
101-
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
102-
Expect(testMachine.SSHConfig.RemoteUsername).To((Equal(remoteUsername)))
101+
if testProvider.VMType() != machine.WSLVirt { // memory and cpus something we cannot set with WSL
102+
Expect(testMachine.Resources.CPUs).To(Equal(uint64(cpus)))
103+
Expect(testMachine.Resources.Memory).To(Equal(uint64(2048)))
104+
}
105+
Expect(testMachine.SSHConfig.RemoteUsername).To(Equal(remoteUsername))
103106

104107
})
105108

106109
It("machine init with cpus, disk size, memory, timezone", func() {
110+
skipIfWSL("setting hardware resource numbers and timezone are not supported on WSL")
107111
name := randomString()
108112
i := new(initMachine)
109113
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withCPUs(2).withDiskSize(102).withMemory(4096).withTimezone("Pacific/Honolulu")).run()
@@ -147,6 +151,7 @@ var _ = Describe("podman machine init", func() {
147151
if testProvider.VMType() == machine.HyperVVirt {
148152
Skip("volumes are not supported on hyperv yet")
149153
}
154+
skipIfWSL("WSL volumes are much different. This test will not pass as is")
150155

151156
tmpDir, err := os.MkdirTemp("", "")
152157
Expect(err).ToNot(HaveOccurred())
@@ -157,20 +162,15 @@ var _ = Describe("podman machine init", func() {
157162

158163
name := randomString()
159164
i := new(initMachine)
160-
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withVolume(mount)).run()
165+
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withVolume(mount).withNow()).run()
161166
Expect(err).ToNot(HaveOccurred())
162167
Expect(session).To(Exit(0))
163168

164-
s := new(startMachine)
165-
startSession, err := mb.setCmd(s).run()
166-
Expect(err).ToNot(HaveOccurred())
167-
Expect(startSession).To(Exit(0))
168-
169-
ssh2 := sshMachine{}
170-
sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHCommand([]string{"ls /testmountdir"})).run()
169+
ssh := sshMachine{}
170+
sshSession, err := mb.setName(name).setCmd(ssh.withSSHCommand([]string{"ls /testmountdir"})).run()
171171
Expect(err).ToNot(HaveOccurred())
172-
Expect(sshSession2).To(Exit(0))
173-
Expect(sshSession2.outputToString()).To(ContainSubstring("example"))
172+
Expect(sshSession).To(Exit(0))
173+
Expect(sshSession.outputToString()).To(ContainSubstring("example"))
174174
})
175175

176176
It("machine init rootless docker.sock check", func() {

0 commit comments

Comments
 (0)