@@ -19,6 +19,7 @@ package converters
1919import (
2020 "testing"
2121
22+ asocontainerservicev1preview "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20230202preview"
2223 asocontainerservicev1 "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20231001"
2324 "github.com/Azure/azure-service-operator/v2/pkg/genruntime"
2425 . "github.com/onsi/gomega"
@@ -107,3 +108,86 @@ func Test_AgentPoolToManagedClusterAgentPoolProfile(t *testing.T) {
107108 })
108109 }
109110}
111+
112+ func Test_AgentPoolToManagedClusterAgentPoolPreviewProfile (t * testing.T ) {
113+ cases := []struct {
114+ name string
115+ pool * asocontainerservicev1preview.ManagedClustersAgentPool
116+ expect func (* GomegaWithT , asocontainerservicev1preview.ManagedClusterAgentPoolProfile )
117+ }{
118+ {
119+ name : "Should set all values correctly" ,
120+ pool : & asocontainerservicev1preview.ManagedClustersAgentPool {
121+ Spec : asocontainerservicev1preview.ManagedClusters_AgentPool_Spec {
122+ AzureName : "agentpool1" ,
123+ VmSize : ptr .To ("Standard_D2s_v3" ),
124+ OsType : ptr .To (asocontainerservicev1preview .OSType_Linux ),
125+ OsDiskSizeGB : ptr.To [asocontainerservicev1preview.ContainerServiceOSDisk ](100 ),
126+ Count : ptr .To (2 ),
127+ Type : ptr .To (asocontainerservicev1preview .AgentPoolType_VirtualMachineScaleSets ),
128+ OrchestratorVersion : ptr .To ("1.22.6" ),
129+ VnetSubnetReference : & genruntime.ResourceReference {
130+ ARMID : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-123/providers/Microsoft.Network/virtualNetworks/vnet-123/subnets/subnet-123" ,
131+ },
132+ Mode : ptr .To (asocontainerservicev1preview .AgentPoolMode_User ),
133+ EnableAutoScaling : ptr .To (true ),
134+ MaxCount : ptr .To (5 ),
135+ MinCount : ptr .To (2 ),
136+ NodeTaints : []string {"key1=value1:NoSchedule" },
137+ AvailabilityZones : []string {"zone1" },
138+ MaxPods : ptr .To (60 ),
139+ OsDiskType : ptr .To (asocontainerservicev1preview .OSDiskType_Managed ),
140+ NodeLabels : map [string ]string {
141+ "custom" : "default" ,
142+ },
143+ Tags : map [string ]string {
144+ "custom" : "default" ,
145+ },
146+ EnableFIPS : ptr .To (true ),
147+ EnableEncryptionAtHost : ptr .To (true ),
148+ },
149+ },
150+
151+ expect : func (g * GomegaWithT , result asocontainerservicev1preview.ManagedClusterAgentPoolProfile ) {
152+ g .Expect (result ).To (Equal (asocontainerservicev1preview.ManagedClusterAgentPoolProfile {
153+ Name : ptr .To ("agentpool1" ),
154+ VmSize : ptr .To ("Standard_D2s_v3" ),
155+ OsType : ptr .To (asocontainerservicev1preview .OSType_Linux ),
156+ OsDiskSizeGB : ptr.To [asocontainerservicev1preview.ContainerServiceOSDisk ](100 ),
157+ Count : ptr .To (2 ),
158+ Type : ptr .To (asocontainerservicev1preview .AgentPoolType_VirtualMachineScaleSets ),
159+ OrchestratorVersion : ptr .To ("1.22.6" ),
160+ VnetSubnetReference : & genruntime.ResourceReference {
161+ ARMID : "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-123/providers/Microsoft.Network/virtualNetworks/vnet-123/subnets/subnet-123" ,
162+ },
163+ Mode : ptr .To (asocontainerservicev1preview .AgentPoolMode_User ),
164+ EnableAutoScaling : ptr .To (true ),
165+ MaxCount : ptr .To (5 ),
166+ MinCount : ptr .To (2 ),
167+ NodeTaints : []string {"key1=value1:NoSchedule" },
168+ AvailabilityZones : []string {"zone1" },
169+ MaxPods : ptr .To (60 ),
170+ OsDiskType : ptr .To (asocontainerservicev1preview .OSDiskType_Managed ),
171+ NodeLabels : map [string ]string {
172+ "custom" : "default" ,
173+ },
174+ Tags : map [string ]string {
175+ "custom" : "default" ,
176+ },
177+ EnableFIPS : ptr .To (true ),
178+ EnableEncryptionAtHost : ptr .To (true ),
179+ }))
180+ },
181+ },
182+ }
183+
184+ for _ , c := range cases {
185+ c := c
186+ t .Run (c .name , func (t * testing.T ) {
187+ t .Parallel ()
188+ g := NewGomegaWithT (t )
189+ result := AgentPoolToManagedClusterAgentPoolPreviewProfile (c .pool )
190+ c .expect (g , result )
191+ })
192+ }
193+ }
0 commit comments