1
0

feat: add cache argument

This commit is contained in:
2023-05-13 10:46:43 +00:00
parent 28acc51417
commit 95695a4070
3 changed files with 100 additions and 0 deletions

31
cache/cache_test.go vendored Normal file
View File

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