From 91ba954eac70e40d63b2678421e7197cd33e0f2e Mon Sep 17 00:00:00 2001 From: wayne Date: Mon, 13 Nov 2023 08:27:35 -0600 Subject: [PATCH] fix discovery teardown (#479) * conformance/discovery: set taglist according to response in previous list req Signed-off-by: wayne warren * conformance/discovery: delete all manifests before attempting to delete blobs, disregard 404 responses Signed-off-by: wayne warren * Update conformance/03_discovery_test.go Co-authored-by: Brandon Mitchell Signed-off-by: wayne * Update conformance/03_discovery_test.go Co-authored-by: Brandon Mitchell Signed-off-by: wayne * Update conformance/03_discovery_test.go Co-authored-by: Brandon Mitchell Signed-off-by: wayne * Update conformance/03_discovery_test.go Co-authored-by: Brandon Mitchell Signed-off-by: wayne --------- Signed-off-by: wayne warren Signed-off-by: wayne Co-authored-by: Brandon Mitchell --- conformance/03_discovery_test.go | 68 ++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/conformance/03_discovery_test.go b/conformance/03_discovery_test.go index bd54c3ee..357b9c63 100644 --- a/conformance/03_discovery_test.go +++ b/conformance/03_discovery_test.go @@ -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) }) @@ -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//manifests/", 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//manifests/", 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), + )) + } }) } @@ -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//manifests/", 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//manifests/", 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), + )) + } }) } @@ -424,6 +451,7 @@ var test03ContentDiscovery = func() { BeNumerically("<", 300), ), Equal(http.StatusMethodNotAllowed), + Equal(http.StatusNotFound), )) }