@@ -52,9 +52,10 @@ var _ = Describe("podman machine init", func() {
5252
5353testMachine := inspectBefore [0 ]
5454Expect (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
6061It ("simple init with start" , func () {
@@ -97,13 +98,16 @@ var _ = Describe("podman machine init", func() {
9798Expect (inspectBefore ).ToNot (BeEmpty ())
9899testMachine := inspectBefore [0 ]
99100Expect (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
106109It ("machine init with cpus, disk size, memory, timezone" , func () {
110+ skipIfWSL ("setting hardware resource numbers and timezone are not supported on WSL" )
107111name := randomString ()
108112i := new (initMachine )
109113session , 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() {
147151if testProvider .VMType () == machine .HyperVVirt {
148152Skip ("volumes are not supported on hyperv yet" )
149153}
154+ skipIfWSL ("WSL volumes are much different. This test will not pass as is" )
150155
151156tmpDir , err := os .MkdirTemp ("" , "" )
152157Expect (err ).ToNot (HaveOccurred ())
@@ -157,20 +162,15 @@ var _ = Describe("podman machine init", func() {
157162
158163name := randomString ()
159164i := 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 ()
161166Expect (err ).ToNot (HaveOccurred ())
162167Expect (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 ()
171171Expect (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
176176It ("machine init rootless docker.sock check" , func () {
0 commit comments