Skip to content

Commit

Permalink
fix discovery teardown (opencontainers#479)
Browse files Browse the repository at this point in the history
* conformance/discovery: set taglist according to response in previous list req

Signed-off-by: wayne warren <[email protected]>

* conformance/discovery: delete all manifests before attempting to delete blobs, disregard 404 responses

Signed-off-by: wayne warren <[email protected]>

* Update conformance/03_discovery_test.go

Co-authored-by: Brandon Mitchell <[email protected]>
Signed-off-by: wayne <[email protected]>

* Update conformance/03_discovery_test.go

Co-authored-by: Brandon Mitchell <[email protected]>
Signed-off-by: wayne <[email protected]>

* Update conformance/03_discovery_test.go

Co-authored-by: Brandon Mitchell <[email protected]>
Signed-off-by: wayne <[email protected]>

* Update conformance/03_discovery_test.go

Co-authored-by: Brandon Mitchell <[email protected]>
Signed-off-by: wayne <[email protected]>

---------

Signed-off-by: wayne warren <[email protected]>
Signed-off-by: wayne <[email protected]>
Co-authored-by: Brandon Mitchell <[email protected]>
  • Loading branch information
waynr and sudo-bmitch authored Nov 13, 2023
1 parent 900e87c commit 91ba954
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions conformance/03_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ var test03ContentDiscovery = func() {
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(Equal(http.StatusOK))
tagList = getTagList(resp)
numTags = len(tagList)
})

Expand Down Expand Up @@ -351,16 +352,29 @@ var test03ContentDiscovery = func() {
g.Specify("Delete created manifest & associated tags", func() {
SkipIfDisabled(contentDiscovery)
RunOnlyIf(runContentDiscoverySetup)
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<digest>", reggie.WithDigest(manifests[2].Digest))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
))
references := []string{
refsIndexArtifactDigest,
manifests[2].Digest,
manifests[4].Digest,
refsManifestAConfigArtifactDigest,
refsManifestALayerArtifactDigest,
testTagName,
refsManifestBConfigArtifactDigest,
refsManifestBLayerArtifactDigest,
}
for _, ref := range references {
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<digest>", reggie.WithDigest(ref))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
Equal(http.StatusNotFound),
))
}
})
}

Expand Down Expand Up @@ -398,16 +412,29 @@ var test03ContentDiscovery = func() {
g.Specify("Delete created manifest & associated tags", func() {
SkipIfDisabled(contentDiscovery)
RunOnlyIf(runContentDiscoverySetup)
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<digest>", reggie.WithDigest(manifests[2].Digest))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
))
references := []string{
refsIndexArtifactDigest,
manifests[2].Digest,
manifests[4].Digest,
refsManifestAConfigArtifactDigest,
refsManifestALayerArtifactDigest,
testTagName,
refsManifestBConfigArtifactDigest,
refsManifestBLayerArtifactDigest,
}
for _, ref := range references {
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<digest>", reggie.WithDigest(ref))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
Equal(http.StatusNotFound),
))
}
})
}

Expand All @@ -424,6 +451,7 @@ var test03ContentDiscovery = func() {
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
Equal(http.StatusNotFound),
))
}

Expand Down

0 comments on commit 91ba954

Please sign in to comment.