Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conformance.test01Pull: Check client errors before using response object #356

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions conformance/01_pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ var test01Pull = func() {
SkipIfDisabled(pull)
RunOnlyIf(runPullSetup)
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/")
resp, _ := client.Do(req)
resp, err := client.Do(req)
Expect(err).To(BeNil())
req = client.NewRequest(reggie.PUT, resp.GetRelativeLocation()).
SetQueryParam("digest", configs[0].Digest).
SetHeader("Content-Type", "application/octet-stream").
SetHeader("Content-Length", configs[0].ContentLength).
SetBody(configs[0].Content)
resp, err := client.Do(req)
resp, err = client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAll(
BeNumerically(">=", 200),
Expand All @@ -36,13 +37,14 @@ var test01Pull = func() {
SkipIfDisabled(pull)
RunOnlyIf(runPullSetup)
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/")
resp, _ := client.Do(req)
resp, err := client.Do(req)
Expect(err).To(BeNil())
req = client.NewRequest(reggie.PUT, resp.GetRelativeLocation()).
SetQueryParam("digest", layerBlobDigest).
SetHeader("Content-Type", "application/octet-stream").
SetHeader("Content-Length", layerBlobContentLength).
SetBody(layerBlobData)
resp, err := client.Do(req)
resp, err = client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAll(
BeNumerically(">=", 200),
Expand All @@ -68,7 +70,8 @@ var test01Pull = func() {
SkipIfDisabled(pull)
RunOnlyIf(runPullSetup)
req := client.NewRequest(reggie.GET, "/v2/<name>/tags/list")
resp, _ := client.Do(req)
resp, err := client.Do(req)
Expect(err).To(BeNil())
tag = getTagNameFromResponse(resp)

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