File tree 2 files changed +8
-9
lines changed
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
package downloader
2
2
3
3
import (
4
+ "net/http"
5
+ "net/http/httptest"
4
6
"os"
5
7
"os/exec"
6
8
"path/filepath"
@@ -12,21 +14,17 @@ import (
12
14
"gotest.tools/v3/assert"
13
15
)
14
16
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
-
21
17
func TestMain (m * testing.M ) {
22
18
HideProgress = true
23
19
os .Exit (m .Run ())
24
20
}
25
21
26
22
func 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
+
30
28
t .Run ("without cache" , func (t * testing.T ) {
31
29
t .Run ("without digest" , func (t * testing.T ) {
32
30
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