File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 11package downloader
22
33import (
4+ "net/http"
5+ "net/http/httptest"
46 "os"
57 "os/exec"
68 "path/filepath"
@@ -12,21 +14,17 @@ import (
1214 "gotest.tools/v3/assert"
1315)
1416
15- // TODO: create a localhost HTTP server to serve the test contents without Internet
16- const (
17- dummyRemoteFileURL = "https://raw.githubusercontent.com/lima-vm/lima/7459f4587987ed014c372f17b82de1817feffa2e/README.md"
18- dummyRemoteFileDigest = "sha256:58d2de96f9d91f0acd93cb1e28bf7c42fc86079037768d6aa63b4e7e7b3c9be0"
19- )
20-
2117func TestMain (m * testing.M ) {
2218 HideProgress = true
2319 os .Exit (m .Run ())
2420}
2521
2622func TestDownloadRemote (t * testing.T ) {
27- if testing .Short () {
28- t .Skip ()
29- }
23+ ts := httptest .NewServer (http .FileServer (http .Dir ("testdata" )))
24+ t .Cleanup (ts .Close )
25+ dummyRemoteFileURL := ts .URL + "/downloader.txt"
26+ const dummyRemoteFileDigest = "sha256:380481d26f897403368be7cb86ca03a4bc14b125bfaf2b93bff809a5a2ad717e"
27+
3028 t .Run ("without cache" , func (t * testing.T ) {
3129 t .Run ("without digest" , func (t * testing.T ) {
3230 localPath := filepath .Join (t .TempDir (), t .Name ())
Original file line number Diff line number Diff line change 1+ This file is used for testing Download function.
You can’t perform that action at this time.
0 commit comments