Skip to content
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
28 changes: 28 additions & 0 deletions conformance/02_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,34 @@ var test02Push = func() {
loc := lastResponse.GetRelativeLocation()
Expect(loc).To(ContainSubstring("/blobs/uploads/"))
})

g.Specify("Cross-mounting without from, and automatic content discovery enabled should return a 201", func() {
SkipIfDisabled(push)
RunOnlyIf(runAutomaticCrossmountTest)
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
RunOnlyIf(automaticCrossmountEnabled)

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

g.Specify("Cross-mounting without from, and automatic content discovery disabled should return a 202", func() {
SkipIfDisabled(push)
RunOnlyIf(runAutomaticCrossmountTest)
RunOnlyIf(lastResponse.StatusCode() == http.StatusCreated)
RunOnlyIfNot(automaticCrossmountEnabled)

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

g.Context("Manifest Upload", func() {
Expand Down
13 changes: 13 additions & 0 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ the environment:
OCI_CROSSMOUNT_NAMESPACE="myorg/other"
```

If you want to test the behaviour of automatic content discovery, you should set the `OCI_AUTOMATIC_CROSSMOUNT` variable.

```
# Do not test automatic cross mounting
unset OCI_AUTOMATIC_CROSSMOUNT

# Test that automatic cross mounting is working as expected
OCI_AUTOMATIC_CROSSMOUNT=1

# Test that automatic cross mounting is disabled
OCI_AUTOMATIC_CROSSMOUNT=0
```

##### Content Discovery

The Content Discovery tests validate that the contents of a registry can be discovered.
Expand Down
76 changes: 41 additions & 35 deletions conformance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const (
envVarAuthScope = "OCI_AUTH_SCOPE"
envVarDeleteManifestBeforeBlobs = "OCI_DELETE_MANIFEST_BEFORE_BLOBS"
envVarCrossmountNamespace = "OCI_CROSSMOUNT_NAMESPACE"
envVarAutomaticCrossmount = "OCI_AUTOMATIC_CROSSMOUNT"

emptyLayerTestTag = "emptylayer"
testTagName = "tagtest0"
Expand All @@ -97,41 +98,43 @@ var (
envVarContentManagement: contentManagement,
}

testBlobA []byte
testBlobALength string
testBlobADigest string
testBlobB []byte
testBlobBDigest string
testBlobBChunk1 []byte
testBlobBChunk1Length string
testBlobBChunk2 []byte
testBlobBChunk2Length string
testBlobBChunk1Range string
testBlobBChunk2Range string
client *reggie.Client
crossmountNamespace string
dummyDigest string
errorCodes []string
invalidManifestContent []byte
layerBlobData []byte
layerBlobDigest string
layerBlobContentLength string
emptyLayerManifestContent []byte
nonexistentManifest string
reportJUnitFilename string
reportHTMLFilename string
httpWriter *httpDebugWriter
testsToRun int
suiteDescription string
runPullSetup bool
runPushSetup bool
runContentDiscoverySetup bool
runContentManagementSetup bool
skipEmptyLayerTest bool
deleteManifestBeforeBlobs bool
configs []TestBlob
manifests []TestBlob
Version = "unknown"
testBlobA []byte
testBlobALength string
testBlobADigest string
testBlobB []byte
testBlobBDigest string
testBlobBChunk1 []byte
testBlobBChunk1Length string
testBlobBChunk2 []byte
testBlobBChunk2Length string
testBlobBChunk1Range string
testBlobBChunk2Range string
client *reggie.Client
crossmountNamespace string
dummyDigest string
errorCodes []string
invalidManifestContent []byte
layerBlobData []byte
layerBlobDigest string
layerBlobContentLength string
emptyLayerManifestContent []byte
nonexistentManifest string
reportJUnitFilename string
reportHTMLFilename string
httpWriter *httpDebugWriter
testsToRun int
suiteDescription string
runPullSetup bool
runPushSetup bool
runContentDiscoverySetup bool
runContentManagementSetup bool
skipEmptyLayerTest bool
deleteManifestBeforeBlobs bool
runAutomaticCrossmountTest bool
automaticCrossmountEnabled bool
configs []TestBlob
manifests []TestBlob
Version = "unknown"
)

func init() {
Expand Down Expand Up @@ -320,6 +323,9 @@ func init() {

skipEmptyLayerTest, _ = strconv.ParseBool(os.Getenv(envVarPushEmptyLayer))
deleteManifestBeforeBlobs, _ = strconv.ParseBool(os.Getenv(envVarDeleteManifestBeforeBlobs))
automaticCrossmountVal := ""
automaticCrossmountVal, runAutomaticCrossmountTest = os.LookupEnv(envVarAutomaticCrossmount)
automaticCrossmountEnabled, _ = strconv.ParseBool(automaticCrossmountVal)
Comment on lines +327 to +328
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I understand correctly, the 201 test will only run if both runAutomaticCrossmountTest and automaticCrossmountEnabled are true?

and the 202 test if runAutomaticCrossmountTest is true and automaticCrossmountEnabled is false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.


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