Skip to content

Commit

Permalink
Merge pull request #19992 from baude/wslenablee2e
Browse files Browse the repository at this point in the history
Enable machine e2e tests for WSL
  • Loading branch information
openshift-merge-robot authored Sep 20, 2023
2 parents eae4e50 + 38f5ead commit 26f25d3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 11 deletions.
13 changes: 10 additions & 3 deletions pkg/machine/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
### HyperV

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

Note: Add `--focus-file "basic_test.go" ` to only run basic test

### 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/. `

Note: Add `--focus-file "basic_test.go" ` to only run basic test
22 changes: 22 additions & 0 deletions pkg/machine/e2e/config_unix_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd

package e2e_test

import (
"github.com/containers/podman/v4/pkg/machine"
. "github.com/onsi/ginkgo/v2"
)

func getDownloadLocation(p machine.VirtProvider) string {
dd, err := p.NewDownload("")
if err != nil {
Fail("unable to create new download")
}

fcd, err := dd.GetFCOSDownload(defaultStream)
if err != nil {
Fail("unable to get virtual machine image")
}

return fcd.Location
}
14 changes: 14 additions & 0 deletions pkg/machine/e2e/config_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
package e2e_test

import (
"github.com/containers/podman/v4/pkg/machine"
"github.com/containers/podman/v4/pkg/machine/wsl"
. "github.com/onsi/ginkgo/v2"
)

const podmanBinary = "../../../bin/windows/podman.exe"

func getDownloadLocation(_ machine.VirtProvider) string {
fd, err := wsl.NewFedoraDownloader(machine.WSLVirt, "", defaultStream.String())
if err != nil {
Fail("unable to get WSL virtual image")
}
return fd.Get().URL.String()
}
15 changes: 7 additions & 8 deletions pkg/machine/e2e/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,23 @@ func TestMachine(t *testing.T) {
}

var _ = BeforeSuite(func() {

testProvider, err := provider.Get()
if err != nil {
Fail("unable to create testProvider")
}

downloadLocation := os.Getenv("MACHINE_IMAGE")

dd, err := testProvider.NewDownload("")
if err != nil {
Fail("unable to create new download")
}
if len(downloadLocation) < 1 {
fcd, err := dd.GetFCOSDownload(defaultStream)
if err != nil {
Fail("unable to get virtual machine image")
downloadLocation = getDownloadLocation(testProvider)
// we cannot simply use OS here because hyperv uses fcos; so WSL is just
// special here
if testProvider.VMType() != machine.WSLVirt {
downloadLocation = getDownloadLocation(testProvider)
}
downloadLocation = fcd.Location
}

compressionExtension := fmt.Sprintf(".%s", testProvider.Compression().String())
suiteImageName = strings.TrimSuffix(path.Base(downloadLocation), compressionExtension)
fqImageName = filepath.Join(tmpDir, suiteImageName)
Expand Down

0 comments on commit 26f25d3

Please sign in to comment.