Merge pull request #20128 from ashley-cui/mach

hyperv: Fixes for info, inspect tests
This commit is contained in:
OpenShift Merge Robot
2023-09-27 00:15:45 -04:00
committed by GitHub
4 changed files with 31 additions and 12 deletions

View File

@ -298,10 +298,16 @@ func (m *MacMachine) Inspect() (*machine.InspectInfo, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
podmanSocket, err := m.forwardSocketPath()
if err != nil {
return nil, err
}
ii := machine.InspectInfo{ ii := machine.InspectInfo{
ConfigPath: m.ConfigPath, ConfigPath: m.ConfigPath,
ConnectionInfo: machine.ConnectionConfig{ ConnectionInfo: machine.ConnectionConfig{
PodmanSocket: nil, PodmanSocket: podmanSocket,
PodmanPipe: nil, PodmanPipe: nil,
}, },
Created: m.Created, Created: m.Created,

View File

@ -13,17 +13,20 @@ Note: you must not have any machines defined before running tests
1. Open a powershell as admin 1. Open a powershell as admin
1. $env:CONTAINERS_MACHINE_PROVIDER="hyperv" 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. `./winmake localmachine`
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/. `
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 ### WSL
1. Open a powershell as a regular user 1. Open a powershell as a regular user
1. Build and copy win-sshproxy into bin/ 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 ## MacOS

View File

@ -1,6 +1,8 @@
package e2e_test package e2e_test
import ( import (
"strconv"
"github.com/containers/podman/v4/pkg/domain/entities" "github.com/containers/podman/v4/pkg/domain/entities"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
@ -27,12 +29,13 @@ var _ = Describe("podman machine info", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(infoSession).Should(Exit(0)) 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) info = new(infoMachine)
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run() infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(infoSession).Should(Exit(0)) 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 // Create a machine and check if info has been updated
i := new(initMachine) i := new(initMachine)
@ -44,7 +47,7 @@ var _ = Describe("podman machine info", func() {
infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run() infoSession, err = mb.setCmd(info.withFormat("{{.Host.NumberOfMachines}}")).run()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(infoSession).Should(Exit(0)) 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 // Check if json is in correct format
infoSession, err = mb.setCmd(info.withFormat("json")).run() infoSession, err = mb.setCmd(info.withFormat("json")).run()

View File

@ -290,9 +290,16 @@ func (m *HyperVMachine) Inspect() (*machine.InspectInfo, error) {
return nil, err return nil, err
} }
podmanSocket, err := m.forwardSocketPath()
if err != nil {
return nil, err
}
return &machine.InspectInfo{ return &machine.InspectInfo{
ConfigPath: m.ConfigPath, ConfigPath: m.ConfigPath,
ConnectionInfo: machine.ConnectionConfig{}, ConnectionInfo: machine.ConnectionConfig{
PodmanSocket: podmanSocket,
},
Created: m.Created, Created: m.Created,
Image: machine.ImageConfig{ Image: machine.ImageConfig{
IgnitionFile: m.IgnitionFile, IgnitionFile: m.IgnitionFile,