tests: remove vmwaretest.ConvertToStreamOptimizedVmdk()
in favor of OpenAsStreamOptimizedVmdk() which is also used by the worker.
This commit is contained in:
parent
3292b5eb68
commit
e41dc46748
2 changed files with 6 additions and 20 deletions
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/openstacktest"
|
||||
"github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/vmwaretest"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/vmware"
|
||||
)
|
||||
|
||||
type testcaseStruct struct {
|
||||
|
|
@ -345,8 +346,12 @@ func testBootUsingVMware(t *testing.T, imagePath string) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// convert to streamOptimized vmdk
|
||||
imagePath, err = vmwaretest.ConvertToStreamOptimizedVmdk(imagePath)
|
||||
imageF, err := vmware.OpenAsStreamOptimizedVmdk(imagePath)
|
||||
require.NoError(t, err)
|
||||
// we don't need the file descriptor to be opened b/c import.vmdk operates
|
||||
// on the file path
|
||||
imageF.Close()
|
||||
imagePath = imageF.Name()
|
||||
require.NotEqual(t, "", imagePath)
|
||||
defer os.Remove(imagePath)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
|
@ -225,21 +224,3 @@ func WithSSHKeyPair(f func(privateKey, publicKey string) error) error {
|
|||
|
||||
return f(private, public)
|
||||
}
|
||||
|
||||
func ConvertToStreamOptimizedVmdk(imagePath string) (string, error) {
|
||||
optimizedVmdk, err := ioutil.TempFile("/var/tmp", "osbuild-composer-stream-optimized-*.vmdk")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
optimizedVmdk.Close()
|
||||
|
||||
cmd := exec.Command(
|
||||
"/usr/bin/qemu-img", "convert", "-O", "vmdk", "-o", "subformat=streamOptimized",
|
||||
imagePath, optimizedVmdk.Name())
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return optimizedVmdk.Name(), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue