diff --git a/internal/policy/container/has_prohibited_container_name_test.go b/internal/policy/container/has_prohibited_container_name_test.go index 8a5c7e3b..87afe682 100644 --- a/internal/policy/container/has_prohibited_container_name_test.go +++ b/internal/policy/container/has_prohibited_container_name_test.go @@ -3,6 +3,7 @@ package container import ( "context" + "github.com/google/go-containerregistry/pkg/name" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -36,6 +37,19 @@ var _ = Describe("HasProhibitedContainerName", func() { Expect(ok).To(BeTrue()) }) }) + Context("When a local registry containing rhcc remote repo path container name does not violate trademark", func() { + BeforeEach(func() { + reference, err := name.ParseReference("local.registry.test.example/quay.io/redhat-isv-containers/12345678900987654321123") + Expect(err).ToNot(HaveOccurred()) + + imageRef.ImageRepository = reference.Context().RepositoryStr() + }) + It("should pass Validate", func() { + ok, err := hasProhibitedContainerName.Validate(context.TODO(), imageRef) + Expect(err).ToNot(HaveOccurred()) + Expect(ok).To(BeTrue()) + }) + }) Context("When a container name violates trademark", func() { BeforeEach(func() { imageRef.ImageRepository = "opdev/red-hat-container"