@@ -25,6 +25,7 @@ import (
2525 "github.com/stretchr/testify/require"
2626 corev1 "k8s.io/api/core/v1"
2727 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+ "k8s.io/utils/ptr"
2829 ipamicv1 "sigs.k8s.io/cluster-api-ipam-provider-in-cluster/api/v1alpha2"
2930 "sigs.k8s.io/controller-runtime/pkg/client"
3031)
@@ -114,7 +115,7 @@ var _ = Describe("ProxmoxCluster Test", func() {
114115
115116 It ("Should allow DHCP for IPv4 config" , func () {
116117 dc := defaultCluster ()
117- dc .Spec .ClusterNetworkConfig .IPv4Config .DHCP = true
118+ dc .Spec .ClusterNetworkConfig .IPv4Config .DHCP = ptr . To ( true )
118119
119120 Expect (k8sClient .Create (context .Background (), dc )).To (Succeed ())
120121 })
@@ -146,7 +147,7 @@ var _ = Describe("ProxmoxCluster Test", func() {
146147 It ("Should allow DHCP for IPV6 config" , func () {
147148 dc := defaultCluster ()
148149 dc .Spec .IPv6Config = & IPConfig {
149- DHCP : true ,
150+ DHCP : ptr . To ( true ) ,
150151 }
151152 Expect (k8sClient .Create (context .Background (), dc )).Should (Succeed ())
152153 })
@@ -217,18 +218,18 @@ func TestClusterNetworkConfig_DHCPEnabled(t *testing.T) {
217218 cl := defaultCluster ()
218219 require .False (t , cl .Spec .ClusterNetworkConfig .DHCPEnabled ())
219220
220- cl .Spec .ClusterNetworkConfig .IPv4Config .DHCP = true
221+ cl .Spec .ClusterNetworkConfig .IPv4Config .DHCP = ptr . To ( true )
221222 require .True (t , cl .Spec .ClusterNetworkConfig .DHCPEnabled ())
222223
223- cl .Spec .ClusterNetworkConfig .IPv4Config .DHCP = true
224- cl .Spec .ClusterNetworkConfig .IPv6Config = & IPConfig {DHCP : true }
224+ cl .Spec .ClusterNetworkConfig .IPv4Config .DHCP = ptr . To ( true )
225+ cl .Spec .ClusterNetworkConfig .IPv6Config = & IPConfig {DHCP : ptr . To ( true ) }
225226 require .True (t , cl .Spec .ClusterNetworkConfig .DHCPEnabled ())
226227
227228 cl .Spec .ClusterNetworkConfig .IPv4Config = nil
228- cl .Spec .ClusterNetworkConfig .IPv6Config = & IPConfig {DHCP : true }
229+ cl .Spec .ClusterNetworkConfig .IPv6Config = & IPConfig {DHCP : ptr . To ( true ) }
229230 require .True (t , cl .Spec .ClusterNetworkConfig .DHCPEnabled ())
230231
231- cl .Spec .ClusterNetworkConfig .IPv4Config = & IPConfig {DHCP : true }
232+ cl .Spec .ClusterNetworkConfig .IPv4Config = & IPConfig {DHCP : ptr . To ( true ) }
232233 cl .Spec .ClusterNetworkConfig .IPv6Config = nil
233234 require .True (t , cl .Spec .ClusterNetworkConfig .DHCPEnabled ())
234235}
0 commit comments