Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperv: Fixes for info, inspect tests #20128

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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