From d7e88754d49be11be4adcad400aeb511b0468c25 Mon Sep 17 00:00:00 2001 From: Saarthak Verma Date: Fri, 3 Jan 2025 22:02:21 +0530 Subject: [PATCH] feat(resume downloads): add basic tests Signed-off-by: Saarthak Verma --- pkg/downloader/uri.go | 6 +++++- pkg/downloader/uri_test.go | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/uri.go b/pkg/downloader/uri.go index 9acbb621..89304ee3 100644 --- a/pkg/downloader/uri.go +++ b/pkg/downloader/uri.go @@ -282,8 +282,12 @@ func (uri URI) DownloadFile(filePath, sha string, fileN, total int, downloadStat if err != nil { return fmt.Errorf("failed to create parent directory for file %q: %v", filePath, err) } - + /** Enabling partial downloads + * - Do I remove the partial file + * - + */ // save partial download to dedicated file + fmt.Printf("DELETEING PARTIAL FILE") tmpFilePath := filePath + ".partial" // remove tmp file diff --git a/pkg/downloader/uri_test.go b/pkg/downloader/uri_test.go index 3b7a80b3..861ee90e 100644 --- a/pkg/downloader/uri_test.go +++ b/pkg/downloader/uri_test.go @@ -38,3 +38,10 @@ var _ = Describe("Gallery API tests", func() { }) }) }) + +var _ = Describe("Download Test", func() { + Context("URI", func() { + It("Resumes partially downloaded files") + It("It accurately updates progress") + }) +})