Skip to content

Commit

Permalink
move location check, allow missing bytes= prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
  • Loading branch information
jdolitsky committed Apr 12, 2023
1 parent 8a73873 commit f0122f6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions conformance/02_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ var test02Push = func() {
location := resp.Header().Get("Location")
Expect(location).ToNot(BeEmpty())
prevResponse = resp

req = client.NewRequest(reggie.PATCH, resp.GetRelativeLocation()).
SetHeader("Content-Type", "application/octet-stream").
SetHeader("Content-Length", testBlobBChunk1Length).
Expand Down Expand Up @@ -220,7 +219,10 @@ var test02Push = func() {
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(Equal(http.StatusNoContent))
Expect(resp.Header().Get("Location")).ToNot(BeEmpty())
Expect(resp.Header().Get("Range")).To(Equal(fmt.Sprintf("bytes=%s", testBlobBChunk1Range)))
Expect(resp.Header().Get("Range")).To(SatisfyAny(
Equal(testBlobBChunk1Range), // Allow missing "bytes=" prefix
Equal(fmt.Sprintf("bytes=%s", testBlobBChunk1Range)),
))
lastResponse = resp
})

Expand Down Expand Up @@ -277,15 +279,13 @@ var test02Push = func() {
Equal(http.StatusCreated),
Equal(http.StatusAccepted),
))
Expect(resp.GetRelativeLocation()).To(Equal(fmt.Sprintf("/v2/%s/blobs/%s", crossmountNamespace, testBlobADigest)))

lastResponse = resp
})

g.Specify("GET request to test digest within cross-mount namespace should return 200", func() {
SkipIfDisabled(push)
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)

Expect(lastResponse.GetRelativeLocation()).To(Equal(fmt.Sprintf("/v2/%s/blobs/%s", crossmountNamespace, testBlobADigest)))
req := client.NewRequest(reggie.GET, lastResponse.GetRelativeLocation())
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expand All @@ -295,7 +295,6 @@ var test02Push = func() {
g.Specify("Cross-mounting of nonexistent blob should yield session id", func() {
SkipIfDisabled(push)
RunOnlyIf(lastResponse.StatusCode() == http.StatusAccepted)

Expect(lastResponse.GetRelativeLocation()).To(HavePrefix(fmt.Sprintf("/v2/%s/blobs/uploads/", crossmountNamespace)))
})

Expand All @@ -304,7 +303,6 @@ var test02Push = func() {
RunOnlyIf(runAutomaticCrossmountTest)
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
RunOnlyIf(automaticCrossmountEnabled)

req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/",
reggie.WithName(crossmountNamespace)).
SetQueryParam("mount", testBlobADigest)
Expand All @@ -318,7 +316,6 @@ var test02Push = func() {
RunOnlyIf(runAutomaticCrossmountTest)
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
RunOnlyIfNot(automaticCrossmountEnabled)

req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/",
reggie.WithName(crossmountNamespace)).
SetQueryParam("mount", testBlobADigest)
Expand Down Expand Up @@ -442,7 +439,6 @@ var test02Push = func() {
))
})
}

})
})
}

0 comments on commit f0122f6

Please sign in to comment.