@@ -22,7 +22,6 @@ import (
2222 "github.com/netbirdio/netbird/shared/management/http/api"
2323
2424 nbv1 "github.com/netbirdio/kubernetes-operator/api/v1"
25- "github.com/netbirdio/kubernetes-operator/internal/util"
2625)
2726
2827var _ = Describe ("NBPolicy Controller" , func () {
@@ -171,13 +170,13 @@ var _ = Describe("NBPolicy Controller", func() {
171170 err = json .Unmarshal (bs , & policyReq )
172171 Expect (err ).NotTo (HaveOccurred ())
173172 Expect (policyReq .Name ).To (Equal ("Test TCP" ))
174- Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
173+ Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
175174 Expect (policyReq .Enabled ).To (BeTrue ())
176175 Expect (policyReq .SourcePostureChecks ).To (BeNil ())
177176 Expect (policyReq .Rules ).To (HaveLen (1 ))
178177 Expect (policyReq .Rules [0 ].Action ).To (BeEquivalentTo (api .PolicyRuleActionAccept ))
179178 Expect (policyReq .Rules [0 ].Bidirectional ).To (BeTrue ())
180- Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
179+ Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
181180 Expect (policyReq .Rules [0 ].DestinationResource ).To (BeNil ())
182181 Expect (policyReq .Rules [0 ].Destinations ).NotTo (BeNil ())
183182 Expect (* policyReq .Rules [0 ].Destinations ).To (HaveLen (1 ))
@@ -220,7 +219,7 @@ var _ = Describe("NBPolicy Controller", func() {
220219 }
221220
222221 nbpolicy .Status .ManagedServiceList = append (nbpolicy .Status .ManagedServiceList , "default/noexist" )
223- nbpolicy .Status .TCPPolicyID = util . Ptr ("policyid" )
222+ nbpolicy .Status .TCPPolicyID = new ("policyid ")
224223 Expect (k8sClient .Status ().Update (ctx , nbpolicy )).To (Succeed ())
225224
226225 mux .HandleFunc ("/api/groups" , func (w http.ResponseWriter , r * http.Request ) {
@@ -309,13 +308,13 @@ var _ = Describe("NBPolicy Controller", func() {
309308 err = json .Unmarshal (bs , & policyReq )
310309 Expect (err ).NotTo (HaveOccurred ())
311310 Expect (policyReq .Name ).To (Equal ("Test UDP" ))
312- Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
311+ Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
313312 Expect (policyReq .Enabled ).To (BeTrue ())
314313 Expect (policyReq .SourcePostureChecks ).To (BeNil ())
315314 Expect (policyReq .Rules ).To (HaveLen (1 ))
316315 Expect (policyReq .Rules [0 ].Action ).To (BeEquivalentTo (api .PolicyRuleActionAccept ))
317316 Expect (policyReq .Rules [0 ].Bidirectional ).To (BeTrue ())
318- Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
317+ Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
319318 Expect (policyReq .Rules [0 ].DestinationResource ).To (BeNil ())
320319 Expect (policyReq .Rules [0 ].Destinations ).NotTo (BeNil ())
321320 Expect (* policyReq .Rules [0 ].Destinations ).To (HaveLen (1 ))
@@ -358,7 +357,7 @@ var _ = Describe("NBPolicy Controller", func() {
358357 }
359358
360359 nbpolicy .Status .ManagedServiceList = append (nbpolicy .Status .ManagedServiceList , "default/noexist" )
361- nbpolicy .Status .UDPPolicyID = util . Ptr ("policyid" )
360+ nbpolicy .Status .UDPPolicyID = new ("policyid ")
362361 Expect (k8sClient .Status ().Update (ctx , nbpolicy )).To (Succeed ())
363362
364363 mux .HandleFunc ("/api/groups" , func (w http.ResponseWriter , r * http.Request ) {
@@ -425,7 +424,7 @@ var _ = Describe("NBPolicy Controller", func() {
425424 Expect (k8sClient .Update (ctx , nbpolicy )).To (Succeed ())
426425
427426 nbpolicy .Status .ManagedServiceList = append (nbpolicy .Status .ManagedServiceList , "default/test" )
428- nbpolicy .Status .TCPPolicyID = util . Ptr ("policyid" )
427+ nbpolicy .Status .TCPPolicyID = new ("policyid ")
429428 Expect (k8sClient .Status ().Update (ctx , nbpolicy )).To (Succeed ())
430429
431430 mux .HandleFunc ("/api/groups" , func (w http.ResponseWriter , r * http.Request ) {
@@ -524,7 +523,7 @@ var _ = Describe("NBPolicy Controller", func() {
524523 Expect (k8sClient .Status ().Update (ctx , nbResourceB )).To (Succeed ())
525524
526525 nbpolicy .Status .ManagedServiceList = append (nbpolicy .Status .ManagedServiceList , "default/test" , "default/test-b" )
527- nbpolicy .Status .TCPPolicyID = util . Ptr ("policyid" )
526+ nbpolicy .Status .TCPPolicyID = new ("policyid ")
528527 Expect (k8sClient .Status ().Update (ctx , nbpolicy )).To (Succeed ())
529528
530529 mux .HandleFunc ("/api/groups" , func (w http.ResponseWriter , r * http.Request ) {
@@ -552,13 +551,13 @@ var _ = Describe("NBPolicy Controller", func() {
552551 err = json .Unmarshal (bs , & policyReq )
553552 Expect (err ).NotTo (HaveOccurred ())
554553 Expect (policyReq .Name ).To (Equal ("Test TCP" ))
555- Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
554+ Expect (policyReq .Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
556555 Expect (policyReq .Enabled ).To (BeTrue ())
557556 Expect (policyReq .SourcePostureChecks ).To (BeNil ())
558557 Expect (policyReq .Rules ).To (HaveLen (1 ))
559558 Expect (policyReq .Rules [0 ].Action ).To (BeEquivalentTo (api .PolicyRuleActionAccept ))
560559 Expect (policyReq .Rules [0 ].Bidirectional ).To (BeTrue ())
561- Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (util . Ptr ("" ))))
560+ Expect (policyReq .Rules [0 ].Description ).To (Or (BeNil (), BeEquivalentTo (new (""))))
562561 Expect (policyReq .Rules [0 ].DestinationResource ).To (BeNil ())
563562 Expect (policyReq .Rules [0 ].Destinations ).NotTo (BeNil ())
564563 Expect (* policyReq .Rules [0 ].Destinations ).To (HaveLen (2 ))
@@ -594,8 +593,8 @@ var _ = Describe("NBPolicy Controller", func() {
594593 Netbird : netbirdClient ,
595594 }
596595
597- nbpolicy .Status .TCPPolicyID = util . Ptr ("policyidtcp" )
598- nbpolicy .Status .UDPPolicyID = util . Ptr ("policyidudp" )
596+ nbpolicy .Status .TCPPolicyID = new ("policyidtcp ")
597+ nbpolicy .Status .UDPPolicyID = new ("policyidudp ")
599598 Expect (k8sClient .Status ().Update (ctx , nbpolicy )).To (Succeed ())
600599
601600 Expect (k8sClient .Delete (ctx , nbpolicy )).To (Succeed ())
0 commit comments