Skip to content

Commit f9b3fc7

Browse files
Merge pull request #20128 from ashley-cui/mach
hyperv: Fixes for info, inspect tests
2 parents 94f47d6 + 127ebe2 commit f9b3fc7

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

pkg/machine/applehv/machine.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,16 @@ func (m *MacMachine) Inspect() (*machine.InspectInfo, error) {
298298
if err != nil {
299299
return nil, err
300300
}
301+
302+
podmanSocket, err := m.forwardSocketPath()
303+
if err != nil {
304+
return nil, err
305+
}
306+
301307
ii := machine.InspectInfo{
302308
ConfigPath: m.ConfigPath,
303309
ConnectionInfo: machine.ConnectionConfig{
304-
PodmanSocket: nil,
310+
PodmanSocket: podmanSocket,
305311
PodmanPipe: nil,
306312
},
307313
Created: m.Created,

pkg/machine/e2e/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@ Note: you must not have any machines defined before running tests
1313

1414
1. Open a powershell as admin
1515
1. $env:CONTAINERS_MACHINE_PROVIDER="hyperv"
16-
1. $env:MACHINE_IMAGE="https://fedorapeople.org/groups/podman/testing/hyperv/fedora-coreos-38.20230830.dev.0-hyperv.x86_64.vhdx.zip"
17-
1. `./test/tools/build/ginkgo.exe -vv --tags "remote exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote" -timeout=90m --trace --no-color pkg/machine/e2e/. `
16+
1. `./winmake localmachine`
1817

19-
Note: Add `--focus-file "basic_test.go" ` to only run basic test
18+
Note: To run specfic test files, add the test files to the end of the winmake command:
19+
20+
`./winmake localmachine "basic_test.go start_test.go"`
2021

2122
### WSL
2223
1. Open a powershell as a regular user
2324
1. Build and copy win-sshproxy into bin/
24-
1. `./test/tools/build/ginkgo.exe -vv --tags "remote exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote" -timeout=90m --trace --no-color pkg/machine/e2e/. `
25+
1. `./winmake localmachine`
2526

26-
Note: Add `--focus-file "basic_test.go" ` to only run basic test
27+
Note: To run specfic test files, add the test files to the end of the winmake command:
28+
29+
`./winmake localmachine "basic_test.go start_test.go"`
2730

2831
## MacOS
2932

pkg/machine/e2e/info_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package e2e_test
22

33
import (
4+
"strconv"
5+
46
"github.com/containers/podman/v4/pkg/domain/entities"
57
jsoniter "github.com/json-iterator/go"
68
. "github.com/onsi/ginkgo/v2"
@@ -27,12 +29,13 @@ var _ = Describe("podman machine info", func() {
2729
Expect(err).NotTo(HaveOccurred())
2830
Expect(infoSession).Should(Exit(0))
2931

30-
// Verify go template works and check for no running machines
32+
// Verify go template works and check for number of machines
3133
info = new(infoMachine)
3234
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
3335
Expect(err).NotTo(HaveOccurred())
3436
Expect(infoSession).Should(Exit(0))
35-
Expect(infoSession.outputToString()).To(Equal("0"))
37+
numMachines, err := strconv.Atoi(infoSession.outputToString())
38+
Expect(err).ToNot(HaveOccurred())
3639

3740
// Create a machine and check if info has been updated
3841
i := new(initMachine)
@@ -44,7 +47,7 @@ var _ = Describe("podman machine info", func() {
4447
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
4548
Expect(err).NotTo(HaveOccurred())
4649
Expect(infoSession).Should(Exit(0))
47-
Expect(infoSession.outputToString()).To(Equal("1"))
50+
Expect(infoSession.outputToString()).To(Equal(strconv.Itoa(numMachines + 1)))
4851

4952
// Check if json is in correct format
5053
infoSession, err = mb.setCmd(info.withFormat("json")).run()

pkg/machine/hyperv/machine.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,17 @@ func (m *HyperVMachine) Inspect() (*machine.InspectInfo, error) {
290290
return nil, err
291291
}
292292

293+
podmanSocket, err := m.forwardSocketPath()
294+
if err != nil {
295+
return nil, err
296+
}
297+
293298
return &machine.InspectInfo{
294-
ConfigPath: m.ConfigPath,
295-
ConnectionInfo: machine.ConnectionConfig{},
296-
Created: m.Created,
299+
ConfigPath: m.ConfigPath,
300+
ConnectionInfo: machine.ConnectionConfig{
301+
PodmanSocket: podmanSocket,
302+
},
303+
Created: m.Created,
297304
Image: machine.ImageConfig{
298305
IgnitionFile: m.IgnitionFile,
299306
ImageStream: "",

0 commit comments

Comments
 (0)