Skip to content

Commit

Permalink
feat: expose crdvalidation testsuite types: TestCasesGroup and TestCa…
Browse files Browse the repository at this point in the history
…ses (#220)
  • Loading branch information
pmalek authored Jan 10, 2025
1 parent 260bd7c commit b7bc51a
Show file tree
Hide file tree
Showing 62 changed files with 165 additions and 125 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v1.0.4
v1.0.5
latest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcacertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongconsumergroups.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongconsumers.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcredentialacls.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcredentialapikeys.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcredentialbasicauths.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcredentialhmacs.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcredentialjwts.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongdataplaneclientcertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongkeys.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongkeysets.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: konglicenses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongpluginbindings.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongplugins.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongroutes.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongservices.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongsnis.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongtargets.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongupstreams.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongvaults.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: konnectapiauthconfigurations.konnect.konghq.com
spec:
group: konnect.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: konnectgatewaycontrolplanes.konnect.konghq.com
spec:
group: konnect.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller-incubator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongservicefacades.incubator.ingress-controller.konghq.com
spec:
group: incubator.ingress-controller.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: ingressclassparameterses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongclusterplugins.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongconsumergroups.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongconsumers.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongcustomentities.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongingresses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: konglicenses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongplugins.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
labels:
gateway.networking.k8s.io/policy: direct
name: kongupstreampolicies.configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: kongvaults.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: tcpingresses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller
kubernetes-configuration.konghq.com/version: v1.0.4
kubernetes-configuration.konghq.com/version: v1.0.5
name: udpingresses.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
3 changes: 2 additions & 1 deletion test/crdsvalidation/kongcacertificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1"
"github.com/kong/kubernetes-configuration/test/crdsvalidation"
)

func TestKongCACertificate(t *testing.T) {
t.Run("required fields validation", func(t *testing.T) {
CRDValidationTestCasesGroup[*configurationv1alpha1.KongCACertificate]{
crdsvalidation.TestCasesGroup[*configurationv1alpha1.KongCACertificate]{
{
Name: "cert field is required",
TestObject: &configurationv1alpha1.KongCACertificate{
Expand Down
5 changes: 3 additions & 2 deletions test/crdsvalidation/kongcertificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1"
"github.com/kong/kubernetes-configuration/test/crdsvalidation"
)

func TestKongCertificate(t *testing.T) {
Expand All @@ -30,7 +31,7 @@ func TestKongCertificate(t *testing.T) {
})

t.Run("required fields", func(t *testing.T) {
CRDValidationTestCasesGroup[*configurationv1alpha1.KongCertificate]{
crdsvalidation.TestCasesGroup[*configurationv1alpha1.KongCertificate]{
{
Name: "cert field is required",
TestObject: &configurationv1alpha1.KongCertificate{
Expand Down Expand Up @@ -88,7 +89,7 @@ func TestKongCertificate(t *testing.T) {
}.Run(t)

t.Run("tags validation", func(t *testing.T) {
CRDValidationTestCasesGroup[*configurationv1alpha1.KongCertificate]{
crdsvalidation.TestCasesGroup[*configurationv1alpha1.KongCertificate]{
{
Name: "up to 20 tags are allowed",
TestObject: &configurationv1alpha1.KongCertificate{
Expand Down
5 changes: 3 additions & 2 deletions test/crdsvalidation/kongconsumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

configurationv1 "github.com/kong/kubernetes-configuration/api/configuration/v1"
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1"
"github.com/kong/kubernetes-configuration/test/crdsvalidation"
)

func TestKongConsumer(t *testing.T) {
Expand All @@ -26,7 +27,7 @@ func TestKongConsumer(t *testing.T) {
})

t.Run("required fields", func(t *testing.T) {
CRDValidationTestCasesGroup[*configurationv1.KongConsumer]{
crdsvalidation.TestCasesGroup[*configurationv1.KongConsumer]{
{
Name: "username or custom_id required (username provided)",
TestObject: &configurationv1.KongConsumer{
Expand Down Expand Up @@ -76,7 +77,7 @@ func TestKongConsumer(t *testing.T) {
})

t.Run("tags validation", func(t *testing.T) {
CRDValidationTestCasesGroup[*configurationv1.KongConsumer]{
crdsvalidation.TestCasesGroup[*configurationv1.KongConsumer]{
{
Name: "up to 20 tags are allowed",
TestObject: &configurationv1.KongConsumer{
Expand Down
Loading

0 comments on commit b7bc51a

Please sign in to comment.