Skip to content

Commit

Permalink
Merge pull request #180 from carolynvs/remove-checksum
Browse files Browse the repository at this point in the history
 New releases are no longer published with a checksum
  • Loading branch information
carolynvs authored Oct 20, 2017
2 parents ca8c06c + 0fce613 commit de68e6e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dvm-helper/dockerversion/dockerversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (version Version) BuildDownloadURL(mirror string) (url string, archived boo
// Docker Store Download
if version.IsEdge() || !version.semver.LessThan(dockerStoreCutoff) {
archived = true
checksumed = !version.IsEdge()
checksumed = false
extSlug = archiveFileExt
if mirror == "" {
mirror = "download.docker.com"
Expand Down
53 changes: 41 additions & 12 deletions dvm-helper/dockerversion/dockerversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,56 @@ func TestVersion_BuildDownloadURL(t *testing.T) {
testcases := map[Version]struct {
wantURL string
wantArchived bool
wantChecksum bool
}{
// original download location, without compression
Parse("1.10.3"): {fmt.Sprintf("https://get.docker.com/builds/%s/%s/docker-1.10.3", dockerOS, dockerArch), false},
Parse("1.10.3"): {
wantURL: fmt.Sprintf("https://get.docker.com/builds/%s/%s/docker-1.10.3", dockerOS, dockerArch),
wantArchived: false,
wantChecksum: true,
},

// original download location, without compression, prerelease
Parse("1.10.0-rc1"): {fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.10.0-rc1", dockerOS, dockerArch), false},
Parse("1.10.0-rc1"): {
wantURL: fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.10.0-rc1", dockerOS, dockerArch),
wantArchived: false,
wantChecksum: true,
},

// compressed binaries
Parse("1.11.0-rc1"): {fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.11.0-rc1.tgz", dockerOS, dockerArch), true},
Parse("1.11.0-rc1"): {
wantURL: fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.11.0-rc1.tgz", dockerOS, dockerArch),
wantArchived: true,
wantChecksum: true,
},

// original version scheme, prerelease binaries
Parse("1.13.0-rc1"): {fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.13.0-rc1.tgz", dockerOS, dockerArch), true},
Parse("1.13.0-rc1"): {
wantURL: fmt.Sprintf("https://test.docker.com/builds/%s/%s/docker-1.13.0-rc1.tgz", dockerOS, dockerArch),
wantArchived: true,
wantChecksum: true,
},

// yearly notation, original download location, release location
Parse("17.03.0-ce"): {fmt.Sprintf("https://get.docker.com/builds/%s/%s/docker-17.03.0-ce%s", dockerOS, dockerArch, archiveFileExt), true},

// docker store download
Parse("17.06.0-ce"): {fmt.Sprintf("https://download.docker.com/%s/static/stable/%s/docker-17.06.0-ce.tgz", mobyOS, dockerArch), true},
Parse("17.03.0-ce"): {
wantURL: fmt.Sprintf("https://get.docker.com/builds/%s/%s/docker-17.03.0-ce%s", dockerOS, dockerArch, archiveFileExt),
wantArchived: true,
wantChecksum: true,
},

// docker store download (no more checksums)
Parse("17.06.0-ce"): {
wantURL: fmt.Sprintf("https://download.docker.com/%s/static/stable/%s/docker-17.06.0-ce.tgz", mobyOS, dockerArch),
wantArchived: true,
wantChecksum: false,
},

// docker store download, prerelease
Parse("17.07.0-ce-rc1"): {fmt.Sprintf("https://download.docker.com/%s/static/test/%s/docker-17.07.0-ce-rc1.tgz", mobyOS, dockerArch), true},
Parse("17.07.0-ce-rc1"): {
wantURL: fmt.Sprintf("https://download.docker.com/%s/static/test/%s/docker-17.07.0-ce-rc1.tgz", mobyOS, dockerArch),
wantArchived: true,
wantChecksum: false,
},
}

for version, testcase := range testcases {
Expand All @@ -152,10 +181,10 @@ func TestVersion_BuildDownloadURL(t *testing.T) {
t.Fatalf("Expected %s to be downloaded from '%s', but got '%s'", version, testcase.wantURL, gotURL)
}
if testcase.wantArchived != gotArchived {
t.Fatalf("Expected %s to use an archived download strategy", version)
t.Fatalf("Expected archive for %s to be %v, got %v", version, testcase.wantArchived, gotArchived)
}
if !gotChecksumed {
t.Fatalf("Expected %s to provide a checksum", version)
if testcase.wantChecksum != gotChecksumed {
t.Fatalf("Expected checksum for %s to be %v, got %v", version, testcase.wantChecksum, gotChecksumed)
}

response, err := http.DefaultClient.Head(gotURL)
Expand Down

0 comments on commit de68e6e

Please sign in to comment.