From 7e39db95d4a2d89d9ddfe24a9eb1fcb02bfb6bb4 Mon Sep 17 00:00:00 2001 From: "Felix Wischke (65278)" Date: Mon, 24 Jun 2024 11:34:44 +0200 Subject: [PATCH] api/v1alpha1/proxmoxcluster_types: add port 0 test --- api/v1alpha1/proxmoxcluster_types_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/v1alpha1/proxmoxcluster_types_test.go b/api/v1alpha1/proxmoxcluster_types_test.go index 4ee9f128..791ffe26 100644 --- a/api/v1alpha1/proxmoxcluster_types_test.go +++ b/api/v1alpha1/proxmoxcluster_types_test.go @@ -108,13 +108,21 @@ var _ = Describe("ProxmoxCluster Test", func() { }) Context("ClusterPort", func() { - It("Should not allow invalid ports", func() { + It("Should not allow ports higher than 65535", func() { dc := defaultCluster() dc.Spec.ControlPlaneEndpoint = &clusterv1.APIEndpoint{ Port: 65536, } Expect(k8sClient.Create(context.Background(), dc)).Should(MatchError(ContainSubstring("port must be within 1-65535"))) }) + + It("Should not allow port 0", func() { + dc := defaultCluster() + dc.Spec.ControlPlaneEndpoint = &clusterv1.APIEndpoint{ + Port: 0, + } + Expect(k8sClient.Create(context.Background(), dc)).Should(MatchError(ContainSubstring("port must be within 1-65535"))) + }) }) Context("IPv4Config", func() {