From 1818d38b033a765ba50a130f70c7c33085b2f412 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 13 May 2023 12:36:19 +0000 Subject: [PATCH] test: cover download debian cache --- cache/cache_test.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cache/cache_test.go b/cache/cache_test.go index 8c7b326..03665f3 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -10,7 +10,6 @@ import ( ) func TestDownloadQemuImage(t *testing.T) { - tmp, err := ioutil.TempDir("", "out-of-tree_") if err != nil { return @@ -28,3 +27,24 @@ func TestDownloadQemuImage(t *testing.T) { t.Fatalf("%s does not exist", file) } } + +func TestDownloadDebianCache(t *testing.T) { + tmp, err := ioutil.TempDir("", "out-of-tree_") + if err != nil { + return + } + defer os.RemoveAll(tmp) + + file := "debian.cache" + + cachePath := filepath.Join(tmp, file) + + err = DownloadDebianCache(cachePath) + if err != nil { + return + } + + if !fs.PathExists(filepath.Join(tmp, file)) { + t.Fatalf("%s does not exist", file) + } +}