Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes #151

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions conformance/02_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ var test02Push = func() {
req := client.NewRequest(reggie.DELETE, "/v2/<name>/blobs/<digest>", reggie.WithDigest(configBlobDigest))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300)))
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
))
})

g.Specify("Delete layer blob created in setup", func() {
Expand All @@ -263,9 +267,13 @@ var test02Push = func() {
req := client.NewRequest(reggie.DELETE, "/v2/<name>/blobs/<digest>", reggie.WithDigest(layerBlobDigest))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300)))
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
))
})

g.Specify("Delete manifest created in tests", func() {
Expand All @@ -274,9 +282,13 @@ var test02Push = func() {
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<digest>", reggie.WithDigest(manifestDigest))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300)))
Expect(resp.StatusCode()).To(SatisfyAny(
SatisfyAll(
BeNumerically(">=", 200),
BeNumerically("<", 300),
),
Equal(http.StatusMethodNotAllowed),
))
})
})
})
Expand Down
5 changes: 3 additions & 2 deletions conformance/04_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ var test04ContentManagement = func() {
})

g.Context("Manifest delete", func() {
g.Specify("DELETE request to manifest tag should return 202, unless tag deletion is disallowed (400)", func() {
g.Specify("DELETE request to manifest tag should return 202, unless tag deletion is disallowed (400/405)", func() {
SkipIfDisabled(contentManagement)
req := client.NewRequest(reggie.DELETE, "/v2/<name>/manifests/<reference>",
reggie.WithReference(tagToDelete))
resp, err := client.Do(req)
Expect(err).To(BeNil())
Expect(resp.StatusCode()).To(SatisfyAny(
Equal(http.StatusBadRequest),
Equal(http.StatusAccepted)))
Equal(http.StatusAccepted),
Equal(http.StatusMethodNotAllowed)))
if resp.StatusCode() == http.StatusBadRequest {
errorResponses, err := resp.Errors()
Expect(err).To(BeNil())
Expand Down
11 changes: 4 additions & 7 deletions conformance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ const (
DENIED
UNSUPPORTED

envTrue = "1"

envVarRootURL = "OCI_ROOT_URL"
envVarNamespace = "OCI_NAMESPACE"
envVarUsername = "OCI_USERNAME"
Expand Down Expand Up @@ -136,10 +134,11 @@ func init() {
username := os.Getenv(envVarUsername)
password := os.Getenv(envVarPassword)
authScope := os.Getenv(envVarAuthScope)
debug := os.Getenv(envVarDebug) == envTrue

debug, _ := strconv.ParseBool(os.Getenv(envVarDebug))

for envVar, enableTest := range testMap {
if os.Getenv(envVar) == envTrue {
if varIsTrue, _ := strconv.ParseBool(os.Getenv(envVar)); varIsTrue {
testsToRun |= enableTest
}
}
Expand Down Expand Up @@ -286,9 +285,7 @@ func init() {
runContentDiscoverySetup = false
}

if os.Getenv(envVarPushEmptyLayer) == envTrue {
skipEmptyLayerTest = true
}
skipEmptyLayerTest, _ = strconv.ParseBool(os.Getenv(envVarPushEmptyLayer))

reportJUnitFilename = "junit.xml"
reportHTMLFilename = "report.html"
Expand Down