Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
  • Loading branch information
pmengelbert committed Nov 9, 2020
1 parent 810b94f commit efd5ae5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 14 additions & 4 deletions conformance/02_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,30 +196,40 @@ var test02Push = func() {
})

g.Context("Cross-Repository Blob Mount", func() {
g.Specify("POST request to mount another repository's blob should return 201", func() {
g.Specify("POST request to mount another repository's blob should return 201 or 202", func() {
SkipIfDisabled(push)
var err error

req := client.NewRequest(reggie.POST, "/v2/<name>/blobs/uploads/",
reggie.WithName(crossmountNamespace)).
SetQueryParam("mount", testBlobADigest).
SetQueryParam("from", client.Config.DefaultName)
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(Equal(http.StatusCreated))
Expect(resp.StatusCode()).To(SatisfyAny(
Equal(http.StatusCreated),
Equal(http.StatusAccepted),
))
Expect(resp.GetRelativeLocation()).To(ContainSubstring(crossmountNamespace))

lastResponse = resp
})

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

req := client.NewRequest(reggie.GET, lastResponse.GetRelativeLocation())
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
})

g.Specify("Cross-mounting of nonexistent blob should yield session id", func() {
SkipIfDisabled(push)
RunOnlyIf(lastResponse.StatusCode() == http.StatusAccepted)

loc := lastResponse.GetRelativeLocation()
Expect(loc).To(ContainSubstring("/blobs/uploads/"))
})
})

g.Context("Manifest Upload", func() {
Expand Down
6 changes: 5 additions & 1 deletion spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ Location: <blob-location>
The digest contained in the `Location` header MAY be different from that of the blob that was mounted. As such, a client
SHOULD use the digest found in the path from this header and SHOULD NOT use the digest of the blob that was mounted.

If the source blob is not found, the response MUST be `404 Not Found`.
The response to an unsuccessful mount MUST be `202 Accepted`, and be handled in the same way as a `POST` request to
`/v2/<name>/blobs/uploads/`<sup>[end-4a](#endpoints)</sup>. That is, it MUST contain the following header, in the following format:
```
Location: /v2/<name>/blobs/uploads/<session-id>
```

##### Pushing Manifests

Expand Down

0 comments on commit efd5ae5

Please sign in to comment.