From 4ee0703aba0ffbf1f1bfaec3972bb08752dc6cc0 Mon Sep 17 00:00:00 2001 From: Wang Yan Date: Tue, 2 Feb 2021 16:23:46 +0800 Subject: [PATCH] update testing code according to the latest spec As PR https://github.com/opencontainers/distribution-spec/pull/206 has been merged, the testing code should be updated accordingly. Signed-off-by: Wang Yan --- conformance/02_push_test.go | 7 +++++-- conformance/setup.go | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/conformance/02_push_test.go b/conformance/02_push_test.go index 6e32478f..1ed6265c 100644 --- a/conformance/02_push_test.go +++ b/conformance/02_push_test.go @@ -60,7 +60,7 @@ var test02Push = func() { Expect(resp.StatusCode()).To(Equal(http.StatusNotFound)) }) - g.Specify("POST request with digest and blob should yield a 201", func() { + g.Specify("POST request with digest and blob should yield a 201 or 202", func() { SkipIfDisabled(push) req := client.NewRequest(reggie.POST, "/v2//blobs/uploads/"). SetHeader("Content-Length", configBlobContentLength). @@ -71,7 +71,10 @@ var test02Push = func() { Expect(err).To(BeNil()) location := resp.Header().Get("Location") Expect(location).ToNot(BeEmpty()) - Expect(resp.StatusCode()).To(Equal(http.StatusCreated)) + Expect(resp.StatusCode()).To(SatisfyAny( + Equal(http.StatusCreated), + Equal(http.StatusAccepted), + )) }) g.Specify("GET request to blob URL from prior request should yield 200", func() { diff --git a/conformance/setup.go b/conformance/setup.go index 2e76c771..6bf62540 100644 --- a/conformance/setup.go +++ b/conformance/setup.go @@ -36,11 +36,9 @@ const ( MANIFEST_BLOB_UNKNOWN MANIFEST_INVALID MANIFEST_UNKNOWN - MANIFEST_UNVERIFIED NAME_INVALID NAME_UNKNOWN SIZE_INVALID - TAG_INVALID UNAUTHORIZED DENIED UNSUPPORTED @@ -268,11 +266,9 @@ func init() { MANIFEST_BLOB_UNKNOWN: "MANIFEST_BLOB_UNKNOWN", MANIFEST_INVALID: "MANIFEST_INVALID", MANIFEST_UNKNOWN: "MANIFEST_UNKNOWN", - MANIFEST_UNVERIFIED: "MANIFEST_UNVERIFIED", NAME_INVALID: "NAME_INVALID", NAME_UNKNOWN: "NAME_UNKNOWN", SIZE_INVALID: "SIZE_INVALID", - TAG_INVALID: "TAG_INVALID", UNAUTHORIZED: "UNAUTHORIZED", DENIED: "DENIED", UNSUPPORTED: "UNSUPPORTED",