Skip to content

Commit

Permalink
Merge pull request #23123 from baude/libkruntest
Browse files Browse the repository at this point in the history
Small fixes for testing libkrun
  • Loading branch information
openshift-merge-bot[bot] authored Jul 2, 2024
2 parents f5d50a6 + d2ca205 commit 3b07ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pkg/machine/e2e/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ var _ = BeforeSuite(func() {
if testProvider.VMType() == define.WSLVirt {
pullError = pullWSLDisk()
} else {
pullError = pullOCITestDisk(tmpDir, testProvider.VMType())
// This is a one-off and a little messy but once WSL switches
// to use OCI disk artifacts, we can make all the conditionals cleaner.
testDiskProvider := testProvider.VMType()
if testDiskProvider == define.LibKrun {
testDiskProvider = define.AppleHvVirt // libkrun uses the applehv image for testing
}
pullError = pullOCITestDisk(tmpDir, testDiskProvider)
}
if pullError != nil {
Fail(fmt.Sprintf("failed to pull wsl disk: %q", pullError))
Fail(fmt.Sprintf("failed to pull disk: %q", pullError))
}
})

Expand Down
6 changes: 4 additions & 2 deletions pkg/machine/shim/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ func Init(opts machineDefine.InitOptions, mp vmconfigs.VMProvider) error {
switch mp.VMType() {
case machineDefine.QemuVirt:
imageExtension = ".qcow2"
case machineDefine.AppleHvVirt:
case machineDefine.AppleHvVirt, machineDefine.LibKrun:
imageExtension = ".raw"
case machineDefine.HyperVVirt:
imageExtension = ".vhdx"
case machineDefine.WSLVirt:
imageExtension = ""
default:
// do nothing
return fmt.Errorf("unknown VM type: %s", mp.VMType())
}

imagePath, err = dirs.DataDir.AppendToNewVMFile(fmt.Sprintf("%s-%s%s", opts.Name, runtime.GOARCH, imageExtension), nil)
Expand Down

0 comments on commit 3b07ae4

Please sign in to comment.