Skip to content

Commit

Permalink
fix: always run but warn if empty layer manifest not supported
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Jun 7, 2023
1 parent b7be2d0 commit fb8fae5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion conformance/02_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,16 @@ var test02Push = func() {

g.Specify("Registry should accept a manifest upload with no layers", func() {
SkipIfDisabled(push)
RunOnlyIfNot(skipEmptyLayerTest)
req := client.NewRequest(reggie.PUT, "/v2/<name>/manifests/<reference>",
reggie.WithReference(emptyLayerTestTag)).
SetHeader("Content-Type", "application/vnd.oci.image.manifest.v1+json").
SetBody(emptyLayerManifestContent)
resp, err := client.Do(req)
Expect(err).To(BeNil())
if resp.StatusCode() != http.StatusCreated {
g.Skip("WARNING: image manifest with no layers is not supported")
}

location := resp.Header().Get("Location")
Expect(location).ToNot(BeEmpty())
Expect(resp.StatusCode()).To(Equal(http.StatusCreated))
Expand Down
2 changes: 2 additions & 0 deletions conformance/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
golang.org/x/net v0.8.0 // indirect
Expand Down
5 changes: 5 additions & 0 deletions conformance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down Expand Up @@ -87,6 +91,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
Expand Down
5 changes: 0 additions & 5 deletions conformance/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ var (
runPushSetup bool
runContentDiscoverySetup bool
runContentManagementSetup bool
skipEmptyLayerTest bool
deleteManifestBeforeBlobs bool
runAutomaticCrossmountTest bool
automaticCrossmountEnabled bool
Expand Down Expand Up @@ -309,7 +308,6 @@ func init() {
runPushSetup = true
runContentDiscoverySetup = true
runContentManagementSetup = true
skipEmptyLayerTest = true
deleteManifestBeforeBlobs = false

if os.Getenv(envVarTagName) != "" &&
Expand All @@ -322,9 +320,6 @@ func init() {
runContentDiscoverySetup = false
}

if v, ok := os.LookupEnv(envVarPushEmptyLayer); ok {
skipEmptyLayerTest, _ = strconv.ParseBool(v)
}
deleteManifestBeforeBlobs, _ = strconv.ParseBool(os.Getenv(envVarDeleteManifestBeforeBlobs))
automaticCrossmountVal := ""
automaticCrossmountVal, runAutomaticCrossmountTest = os.LookupEnv(envVarAutomaticCrossmount)
Expand Down

0 comments on commit fb8fae5

Please sign in to comment.