Merge pull request #19992 from baude/wslenablee2e

Enable machine e2e tests for WSL
This commit is contained in:
OpenShift Merge Robot
2023-09-20 10:22:07 +02:00
committed by GitHub
4 changed files with 53 additions and 11 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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()
}

View File

@ -44,6 +44,7 @@ func TestMachine(t *testing.T) {
}
var _ = BeforeSuite(func() {
testProvider, err := provider.Get()
if err != nil {
Fail("unable to create testProvider")
@ -51,17 +52,15 @@ var _ = BeforeSuite(func() {
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)