Skip to content

Commit f787b66

Browse files
committed
adding test to cover local registries that reference rhcc registry
Signed-off-by: Adam D. Cornett <[email protected]>
1 parent fd13126 commit f787b66

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

internal/policy/container/has_prohibited_container_name_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package container
33
import (
44
"context"
55

6+
"github.com/google/go-containerregistry/pkg/name"
67
. "github.com/onsi/ginkgo/v2"
78
. "github.com/onsi/gomega"
89

@@ -36,6 +37,19 @@ var _ = Describe("HasProhibitedContainerName", func() {
3637
Expect(ok).To(BeTrue())
3738
})
3839
})
40+
Context("When a local registry containing rhcc remote repo path container name does not violate trademark", func() {
41+
BeforeEach(func() {
42+
reference, err := name.ParseReference("local.registry.test.example/quay.io/redhat-isv-containers/12345678900987654321123")
43+
Expect(err).ToNot(HaveOccurred())
44+
45+
imageRef.ImageRepository = reference.Context().RepositoryStr()
46+
})
47+
It("should pass Validate", func() {
48+
ok, err := hasProhibitedContainerName.Validate(context.TODO(), imageRef)
49+
Expect(err).ToNot(HaveOccurred())
50+
Expect(ok).To(BeTrue())
51+
})
52+
})
3953
Context("When a container name violates trademark", func() {
4054
BeforeEach(func() {
4155
imageRef.ImageRepository = "opdev/red-hat-container"

0 commit comments

Comments
 (0)