diff --git a/pkg/plugins/policies/meshhttproute/api/v1alpha1/v1alpha1_suite_test.go b/pkg/plugins/policies/meshhttproute/api/v1alpha1/v1alpha1_suite_test.go new file mode 100644 index 000000000000..871c9ebefa90 --- /dev/null +++ b/pkg/plugins/policies/meshhttproute/api/v1alpha1/v1alpha1_suite_test.go @@ -0,0 +1,11 @@ +package v1alpha1_test + +import ( + "testing" + + "github.com/kumahq/kuma/pkg/test" +) + +func TestPlugin(t *testing.T) { + test.RunSpecs(t, "MeshHTTPRoute") +} diff --git a/pkg/plugins/policies/meshhttproute/api/v1alpha1/validation_test.go b/pkg/plugins/policies/meshhttproute/api/v1alpha1/validation_test.go new file mode 100644 index 000000000000..bcd4ba75e299 --- /dev/null +++ b/pkg/plugins/policies/meshhttproute/api/v1alpha1/validation_test.go @@ -0,0 +1,41 @@ +package v1alpha1_test + +import ( + . "github.com/onsi/ginkgo/v2" + + "github.com/kumahq/kuma/pkg/core/validators" + api "github.com/kumahq/kuma/pkg/plugins/policies/meshhttproute/api/v1alpha1" + + . "github.com/kumahq/kuma/pkg/test/resources" +) + +var _ = Describe("validation", func() { + DescribeErrorCases( + api.NewMeshHTTPRouteResource, + ErrorCase("basic error", + validators.Violation{ + Field: `spec.targetRef.kind`, + Message: `value is not supported`, + }, ` +type: MeshHTTPRoute +mesh: mesh-1 +name: route-1 +targetRef: + kind: BlahBlah + name: frontend +to: [] +`), + ) + DescribeValidCases( + api.NewMeshHTTPRouteResource, + Entry("accepts valid resource", ` +type: MeshHTTPRoute +mesh: mesh-1 +name: route-1 +targetRef: + kind: MeshService + name: frontend +to: [] +`), + ) +})