| | |
| | | } |
| | | } |
| | | |
| | | func TestDownloadProfileRemovesStalePartialDownload(t *testing.T) { |
| | | root := t.TempDir() |
| | | stalePath := filepath.Join(root, ".downloads", DefaultModelID, "old-run", "model_package") |
| | | writeTestFile(t, stalePath, "partial") |
| | | |
| | | err := DownloadProfile(DefaultModelProfile(), []string{"://bad-url"}, root, nil) |
| | | if err == nil { |
| | | t.Fatal("expected download failure") |
| | | } |
| | | if _, statErr := os.Stat(filepath.Dir(stalePath)); !os.IsNotExist(statErr) { |
| | | t.Fatalf("stale download run still exists or stat failed: %v", statErr) |
| | | } |
| | | } |
| | | |
| | | func TestDownloadProfileFallsBackWhenPrimaryArchiveInvalid(t *testing.T) { |
| | | root := t.TempDir() |
| | | validArchive := tarArchive(t, map[string]string{ |