Skip to content

Commit f0122f6

Browse files
committed
move location check, allow missing bytes= prefix
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
1 parent 8a73873 commit f0122f6

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

conformance/02_push_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ var test02Push = func() {
188188
location := resp.Header().Get("Location")
189189
Expect(location).ToNot(BeEmpty())
190190
prevResponse = resp
191-
192191
req = client.NewRequest(reggie.PATCH, resp.GetRelativeLocation()).
193192
SetHeader("Content-Type", "application/octet-stream").
194193
SetHeader("Content-Length", testBlobBChunk1Length).
@@ -220,7 +219,10 @@ var test02Push = func() {
220219
Expect(err).To(BeNil())
221220
Expect(resp.StatusCode()).To(Equal(http.StatusNoContent))
222221
Expect(resp.Header().Get("Location")).ToNot(BeEmpty())
223-
Expect(resp.Header().Get("Range")).To(Equal(fmt.Sprintf("bytes=%s", testBlobBChunk1Range)))
222+
Expect(resp.Header().Get("Range")).To(SatisfyAny(
223+
Equal(testBlobBChunk1Range), // Allow missing "bytes=" prefix
224+
Equal(fmt.Sprintf("bytes=%s", testBlobBChunk1Range)),
225+
))
224226
lastResponse = resp
225227
})
226228

@@ -277,15 +279,13 @@ var test02Push = func() {
277279
Equal(http.StatusCreated),
278280
Equal(http.StatusAccepted),
279281
))
280-
Expect(resp.GetRelativeLocation()).To(Equal(fmt.Sprintf("/v2/%s/blobs/%s", crossmountNamespace, testBlobADigest)))
281-
282282
lastResponse = resp
283283
})
284284

285285
g.Specify("GET request to test digest within cross-mount namespace should return 200", func() {
286286
SkipIfDisabled(push)
287287
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
288-
288+
Expect(lastResponse.GetRelativeLocation()).To(Equal(fmt.Sprintf("/v2/%s/blobs/%s", crossmountNamespace, testBlobADigest)))
289289
req := client.NewRequest(reggie.GET, lastResponse.GetRelativeLocation())
290290
resp, err := client.Do(req)
291291
Expect(err).To(BeNil())
@@ -295,7 +295,6 @@ var test02Push = func() {
295295
g.Specify("Cross-mounting of nonexistent blob should yield session id", func() {
296296
SkipIfDisabled(push)
297297
RunOnlyIf(lastResponse.StatusCode() == http.StatusAccepted)
298-
299298
Expect(lastResponse.GetRelativeLocation()).To(HavePrefix(fmt.Sprintf("/v2/%s/blobs/uploads/", crossmountNamespace)))
300299
})
301300

@@ -304,7 +303,6 @@ var test02Push = func() {
304303
RunOnlyIf(runAutomaticCrossmountTest)
305304
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
306305
RunOnlyIf(automaticCrossmountEnabled)
307-
308306
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/",
309307
reggie.WithName(crossmountNamespace)).
310308
SetQueryParam("mount", testBlobADigest)
@@ -318,7 +316,6 @@ var test02Push = func() {
318316
RunOnlyIf(runAutomaticCrossmountTest)
319317
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
320318
RunOnlyIfNot(automaticCrossmountEnabled)
321-
322319
req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/",
323320
reggie.WithName(crossmountNamespace)).
324321
SetQueryParam("mount", testBlobADigest)
@@ -442,7 +439,6 @@ var test02Push = func() {
442439
))
443440
})
444441
}
445-
446442
})
447443
})
448444
}

0 commit comments

Comments
 (0)