Skip to content

Commit f72e501

Browse files
authored
Merge pull request #356 from bmoylan/bm/check-pull-errors
conformance.test01Pull: Check client errors before using response object
2 parents b76b344 + 315c7e0 commit f72e501

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

conformance/01_pull_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ var test01Pull = func() {
1919
SkipIfDisabled(pull)
2020
RunOnlyIf(runPullSetup)
2121
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/")
22-
resp, _ := client.Do(req)
22+
resp, err := client.Do(req)
23+
Expect(err).To(BeNil())
2324
req = client.NewRequest(reggie.PUT, resp.GetRelativeLocation()).
2425
SetQueryParam("digest", configs[0].Digest).
2526
SetHeader("Content-Type", "application/octet-stream").
2627
SetHeader("Content-Length", configs[0].ContentLength).
2728
SetBody(configs[0].Content)
28-
resp, err := client.Do(req)
29+
resp, err = client.Do(req)
2930
Expect(err).To(BeNil())
3031
Expect(resp.StatusCode()).To(SatisfyAll(
3132
BeNumerically(">=", 200),
@@ -36,13 +37,14 @@ var test01Pull = func() {
3637
SkipIfDisabled(pull)
3738
RunOnlyIf(runPullSetup)
3839
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/")
39-
resp, _ := client.Do(req)
40+
resp, err := client.Do(req)
41+
Expect(err).To(BeNil())
4042
req = client.NewRequest(reggie.PUT, resp.GetRelativeLocation()).
4143
SetQueryParam("digest", layerBlobDigest).
4244
SetHeader("Content-Type", "application/octet-stream").
4345
SetHeader("Content-Length", layerBlobContentLength).
4446
SetBody(layerBlobData)
45-
resp, err := client.Do(req)
47+
resp, err = client.Do(req)
4648
Expect(err).To(BeNil())
4749
Expect(resp.StatusCode()).To(SatisfyAll(
4850
BeNumerically(">=", 200),
@@ -68,7 +70,8 @@ var test01Pull = func() {
6870
SkipIfDisabled(pull)
6971
RunOnlyIf(runPullSetup)
7072
req := client.NewRequest(reggie.GET, "/v2/<name>/tags/list")
71-
resp, _ := client.Do(req)
73+
resp, err := client.Do(req)
74+
Expect(err).To(BeNil())
7275
tag = getTagNameFromResponse(resp)
7376

7477
// attempt to forcibly overwrite this tag with the unique manifest for this run

0 commit comments

Comments
 (0)