Skip to content

Commit

Permalink
Merge pull request #20128 from ashley-cui/mach
Browse files Browse the repository at this point in the history
hyperv: Fixes for info, inspect tests
  • Loading branch information
openshift-merge-robot authored Sep 27, 2023
2 parents 94f47d6 + 127ebe2 commit f9b3fc7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
8 changes: 7 additions & 1 deletion pkg/machine/applehv/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,16 @@ func (m *MacMachine) Inspect() (*machine.InspectInfo, error) {
if err != nil {
return nil, err
}

podmanSocket, err := m.forwardSocketPath()
if err != nil {
return nil, err
}

ii := machine.InspectInfo{
ConfigPath: m.ConfigPath,
ConnectionInfo: machine.ConnectionConfig{
PodmanSocket: nil,
PodmanSocket: podmanSocket,
PodmanPipe: nil,
},
Created: m.Created,
Expand Down
13 changes: 8 additions & 5 deletions pkg/machine/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ Note: you must not have any machines defined before running tests

1. Open a powershell as admin
1. $env:CONTAINERS_MACHINE_PROVIDER="hyperv"
1. $env:MACHINE_IMAGE="https://fedorapeople.org/groups/podman/testing/hyperv/fedora-coreos-38.20230830.dev.0-hyperv.x86_64.vhdx.zip"
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/. `
1. `./winmake localmachine`

Note: Add `--focus-file "basic_test.go" ` to only run basic test
Note: To run specfic test files, add the test files to the end of the winmake command:

`./winmake localmachine "basic_test.go start_test.go"`

### WSL
1. Open a powershell as a regular user
1. Build and copy win-sshproxy into bin/
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/. `
1. `./winmake localmachine`

Note: Add `--focus-file "basic_test.go" ` to only run basic test
Note: To run specfic test files, add the test files to the end of the winmake command:

`./winmake localmachine "basic_test.go start_test.go"`

## MacOS

Expand Down
9 changes: 6 additions & 3 deletions pkg/machine/e2e/info_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package e2e_test

import (
"strconv"

"github.com/containers/podman/v4/pkg/domain/entities"
jsoniter "github.com/json-iterator/go"
. "github.com/onsi/ginkgo/v2"
Expand All @@ -27,12 +29,13 @@ var _ = Describe("podman machine info", func() {
Expect(err).NotTo(HaveOccurred())
Expect(infoSession).Should(Exit(0))

// Verify go template works and check for no running machines
// Verify go template works and check for number of machines
info = new(infoMachine)
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
Expect(err).NotTo(HaveOccurred())
Expect(infoSession).Should(Exit(0))
Expect(infoSession.outputToString()).To(Equal("0"))
numMachines, err := strconv.Atoi(infoSession.outputToString())
Expect(err).ToNot(HaveOccurred())

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

// Check if json is in correct format
infoSession, err = mb.setCmd(info.withFormat("json")).run()
Expand Down
13 changes: 10 additions & 3 deletions pkg/machine/hyperv/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,17 @@ func (m *HyperVMachine) Inspect() (*machine.InspectInfo, error) {
return nil, err
}

podmanSocket, err := m.forwardSocketPath()
if err != nil {
return nil, err
}

return &machine.InspectInfo{
ConfigPath: m.ConfigPath,
ConnectionInfo: machine.ConnectionConfig{},
Created: m.Created,
ConfigPath: m.ConfigPath,
ConnectionInfo: machine.ConnectionConfig{
PodmanSocket: podmanSocket,
},
Created: m.Created,
Image: machine.ImageConfig{
IgnitionFile: m.IgnitionFile,
ImageStream: "",
Expand Down

0 comments on commit f9b3fc7

Please sign in to comment.