From 80952db0ba7063e557c49146fd2d738c929f9885 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Fri, 22 Sep 2023 14:50:25 -0400 Subject: [PATCH 1/3] Fix podman machine info test for hyperV We do not guarantee that the amount of machines that exist on the system is 0 before running a test. Signed-off-by: Ashley Cui --- pkg/machine/e2e/info_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/machine/e2e/info_test.go b/pkg/machine/e2e/info_test.go index def9defbd7..b016e3e1e1 100644 --- a/pkg/machine/e2e/info_test.go +++ b/pkg/machine/e2e/info_test.go @@ -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" @@ -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) @@ -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() From 995a6a8ac414594b70545c5871e5f34e21a2cf07 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Mon, 25 Sep 2023 01:11:52 -0400 Subject: [PATCH 2/3] Add podman socket info to machine inspect HyperV and appleHV machine inspect commands were missing podman socket info. This also fixes machine inspect tests on hyperV Signed-off-by: Ashley Cui --- pkg/machine/applehv/machine.go | 8 +++++++- pkg/machine/hyperv/machine.go | 13 ++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pkg/machine/applehv/machine.go b/pkg/machine/applehv/machine.go index d91c602fb0..0d2ba2adb7 100644 --- a/pkg/machine/applehv/machine.go +++ b/pkg/machine/applehv/machine.go @@ -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, diff --git a/pkg/machine/hyperv/machine.go b/pkg/machine/hyperv/machine.go index 93298a9094..b6f091cdfc 100644 --- a/pkg/machine/hyperv/machine.go +++ b/pkg/machine/hyperv/machine.go @@ -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: "", From 127ebe2b27722a6f7617478a363598116005f1f8 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Mon, 25 Sep 2023 01:55:54 -0400 Subject: [PATCH 3/3] Update machine tests README Windows now has a winmake file for easier testing, so document that. Signed-off-by: Ashley Cui --- pkg/machine/e2e/README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/machine/e2e/README.md b/pkg/machine/e2e/README.md index bf64b5c3fa..a516dfdb37 100644 --- a/pkg/machine/e2e/README.md +++ b/pkg/machine/e2e/README.md @@ -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