Skip to content

Commit

Permalink
adding test to cover local registries that reference rhcc registry
Browse files Browse the repository at this point in the history
Signed-off-by: Adam D. Cornett <adc@redhat.com>
  • Loading branch information
acornett21 committed Dec 11, 2024
1 parent fd13126 commit f787b66
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/policy/container/has_prohibited_container_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package container
import (
"context"

"github.com/google/go-containerregistry/pkg/name"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f787b66

Please sign in to comment.