1
0
Fork 0

test: add download image test

master
dump_stack() 2023-05-13 09:31:25 +00:00
parent da5797766b
commit 2977b6f7fd
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 29 additions and 0 deletions

29
images_test.go Normal file
View File

@ -0,0 +1,29 @@
package main
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"code.dumpstack.io/tools/out-of-tree/fs"
)
func TestDownloadImage(t *testing.T) {
tmp, err := ioutil.TempDir("", "out-of-tree_")
if err != nil {
return
}
defer os.RemoveAll(tmp)
file := "out_of_tree_ubuntu_12__04.img"
err = downloadImage(tmp, file)
if err != nil {
t.Fatal(err)
}
if !fs.PathExists(filepath.Join(tmp, file)) {
t.Fatalf("%s does not exist", file)
}
}