mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #19992 from baude/wslenablee2e
Enable machine e2e tests for WSL
This commit is contained in:
@ -12,8 +12,15 @@
|
|||||||
### HyperV
|
### HyperV
|
||||||
|
|
||||||
1. Open a powershell as admin
|
1. Open a powershell as admin
|
||||||
2. $env:CONTAINERS_MACHINE_PROVIDER="hyperv"
|
1. $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"
|
1. $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. `./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
|
Note: Add `--focus-file "basic_test.go" ` to only run basic test
|
||||||
|
22
pkg/machine/e2e/config_unix_test.go
Normal file
22
pkg/machine/e2e/config_unix_test.go
Normal 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
|
||||||
|
}
|
@ -1,3 +1,17 @@
|
|||||||
package e2e_test
|
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"
|
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()
|
||||||
|
}
|
||||||
|
@ -44,6 +44,7 @@ func TestMachine(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _ = BeforeSuite(func() {
|
var _ = BeforeSuite(func() {
|
||||||
|
|
||||||
testProvider, err := provider.Get()
|
testProvider, err := provider.Get()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail("unable to create testProvider")
|
Fail("unable to create testProvider")
|
||||||
@ -51,17 +52,15 @@ var _ = BeforeSuite(func() {
|
|||||||
|
|
||||||
downloadLocation := os.Getenv("MACHINE_IMAGE")
|
downloadLocation := os.Getenv("MACHINE_IMAGE")
|
||||||
|
|
||||||
dd, err := testProvider.NewDownload("")
|
|
||||||
if err != nil {
|
|
||||||
Fail("unable to create new download")
|
|
||||||
}
|
|
||||||
if len(downloadLocation) < 1 {
|
if len(downloadLocation) < 1 {
|
||||||
fcd, err := dd.GetFCOSDownload(defaultStream)
|
downloadLocation = getDownloadLocation(testProvider)
|
||||||
if err != nil {
|
// we cannot simply use OS here because hyperv uses fcos; so WSL is just
|
||||||
Fail("unable to get virtual machine image")
|
// special here
|
||||||
|
if testProvider.VMType() != machine.WSLVirt {
|
||||||
|
downloadLocation = getDownloadLocation(testProvider)
|
||||||
}
|
}
|
||||||
downloadLocation = fcd.Location
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compressionExtension := fmt.Sprintf(".%s", testProvider.Compression().String())
|
compressionExtension := fmt.Sprintf(".%s", testProvider.Compression().String())
|
||||||
suiteImageName = strings.TrimSuffix(path.Base(downloadLocation), compressionExtension)
|
suiteImageName = strings.TrimSuffix(path.Base(downloadLocation), compressionExtension)
|
||||||
fqImageName = filepath.Join(tmpDir, suiteImageName)
|
fqImageName = filepath.Join(tmpDir, suiteImageName)
|
||||||
|
Reference in New Issue
Block a user