@@ -19,7 +19,6 @@ package scope
1919import (
2020 "context"
2121 "fmt"
22- "reflect"
2322 "testing"
2423
2524 "github.com/golang/mock/gomock"
@@ -138,18 +137,16 @@ func TestManagedMachinePoolCreate(t *testing.T) {
138137 ObjectMeta : metav1.ObjectMeta {
139138 Name : "test" ,
140139 },
140+ Spec : infrav1exp.OCIManagedMachinePoolSpec {
141+ Version : common .String ("v1.24.5" ),
142+ },
141143 },
142144 OCIManagedCluster : ociManagedCluster ,
143145 Cluster : & clusterv1.Cluster {
144146 Spec : clusterv1.ClusterSpec {},
145147 },
146148 MachinePool : & expclusterv1.MachinePool {
147149 Spec : expclusterv1.MachinePoolSpec {
148- Template : clusterv1.MachineTemplateSpec {
149- Spec : clusterv1.MachineSpec {
150- Version : common .String ("v1.24.5" ),
151- },
152- },
153150 Replicas : & size ,
154151 },
155152 },
@@ -177,6 +174,7 @@ func TestManagedMachinePoolCreate(t *testing.T) {
177174 testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
178175 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
179176 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
177+ Version : common .String ("v1.24.5" ),
180178 NodeMetadata : map [string ]string {"key1" : "value1" },
181179 InitialNodeLabels : []infrav1exp.KeyValue {{
182180 Key : common .String ("key" ),
@@ -208,7 +206,7 @@ func TestManagedMachinePoolCreate(t *testing.T) {
208206 CniType : infrav1exp .VCNNativeCNI ,
209207 VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
210208 SubnetNames : []string {"pod-subnet" },
211- MaxPodsPerNode : common .Int (15 ),
209+ MaxPodsPerNode : common .Int (25 ),
212210 NSGNames : []string {"pod-nsg" },
213211 },
214212 },
@@ -258,7 +256,7 @@ func TestManagedMachinePoolCreate(t *testing.T) {
258256 DefinedTags : definedTagsInterface ,
259257 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
260258 PodSubnetIds : []string {"pod-subnet-id" },
261- MaxPodsPerNode : common .Int (15 ),
259+ MaxPodsPerNode : common .Int (25 ),
262260 PodNsgIds : []string {"pod-nsg-id" },
263261 },
264262 },
@@ -302,6 +300,7 @@ func TestManagedMachinePoolCreate(t *testing.T) {
302300 testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
303301 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
304302 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
303+ Version : common .String ("v1.24.5" ),
305304 NodeMetadata : map [string ]string {"key1" : "value1" },
306305 InitialNodeLabels : []infrav1exp.KeyValue {{
307306 Key : common .String ("key" ),
@@ -565,18 +564,17 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
565564 ObjectMeta : metav1.ObjectMeta {
566565 Name : "test" ,
567566 },
567+ Spec : infrav1exp.OCIManagedMachinePoolSpec {
568+ Version : common .String ("v1.24.5" ),
569+ },
568570 },
569571 OCIManagedCluster : ociManagedCluster ,
570572 Cluster : & clusterv1.Cluster {
571573 Spec : clusterv1.ClusterSpec {},
572574 },
573575 MachinePool : & expclusterv1.MachinePool {
574576 Spec : expclusterv1.MachinePoolSpec {
575- Template : clusterv1.MachineTemplateSpec {
576- Spec : clusterv1.MachineSpec {
577- Version : common .String ("v1.24.5" ),
578- },
579- },
577+ Template : clusterv1.MachineTemplateSpec {},
580578 Replicas : & size ,
581579 },
582580 },
@@ -605,6 +603,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
605603 testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
606604 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
607605 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
606+ Version : common .String ("v1.24.5" ),
608607 NodeMetadata : map [string ]string {"key1" : "value1" },
609608 InitialNodeLabels : []infrav1exp.KeyValue {{
610609 Key : common .String ("key" ),
@@ -634,9 +633,8 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
634633 NodePoolPodNetworkOptionDetails : & infrav1exp.NodePoolPodNetworkOptionDetails {
635634 CniType : infrav1exp .VCNNativeCNI ,
636635 VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
637- SubnetNames : []string {"pod-subnet" },
638- MaxPodsPerNode : common .Int (15 ),
639- NSGNames : []string {"pod-nsg" },
636+ SubnetNames : []string {"pod-subnet" },
637+ NSGNames : []string {"pod-nsg" },
640638 },
641639 },
642640 },
@@ -684,7 +682,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
684682 DefinedTags : definedTagsInterface ,
685683 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
686684 PodSubnetIds : []string {"pod-subnet-id" },
687- MaxPodsPerNode : common .Int (15 ),
685+ MaxPodsPerNode : common .Int (31 ),
688686 PodNsgIds : []string {"pod-nsg-id" },
689687 },
690688 },
@@ -700,6 +698,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
700698 testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
701699 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
702700 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
701+ Version : common .String ("v1.24.5" ),
703702 ID : common .String ("node-pool-id" ),
704703 NodeMetadata : map [string ]string {"key1" : "value1" },
705704 InitialNodeLabels : []infrav1exp.KeyValue {{
@@ -731,7 +730,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
731730 CniType : infrav1exp .VCNNativeCNI ,
732731 VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
733732 SubnetNames : []string {"pod-subnet" },
734- MaxPodsPerNode : common .Int (15 ),
733+ MaxPodsPerNode : common .Int (31 ),
735734 NSGNames : []string {"pod-nsg" },
736735 },
737736 },
@@ -775,7 +774,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
775774 IsPvEncryptionInTransitEnabled : common .Bool (true ),
776775 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
777776 PodSubnetIds : []string {"pod-subnet-id" },
778- MaxPodsPerNode : common .Int (15 ),
777+ MaxPodsPerNode : common .Int (31 ),
779778 PodNsgIds : []string {"pod-nsg-id" },
780779 },
781780 },
@@ -828,7 +827,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
828827 DefinedTags : definedTagsInterface ,
829828 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
830829 PodSubnetIds : []string {"pod-subnet-id" },
831- MaxPodsPerNode : common .Int (15 ),
830+ MaxPodsPerNode : common .Int (31 ),
832831 PodNsgIds : []string {"pod-nsg-id" },
833832 },
834833 },
@@ -844,6 +843,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
844843 testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
845844 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
846845 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
846+ Version : common .String ("v1.24.5" ),
847847 ID : common .String ("node-pool-id" ),
848848 NodeMetadata : map [string ]string {"key1" : "value1" },
849849 InitialNodeLabels : []infrav1exp.KeyValue {{
@@ -875,7 +875,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
875875 CniType : infrav1exp .VCNNativeCNI ,
876876 VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
877877 SubnetNames : []string {"pod-subnet" },
878- MaxPodsPerNode : common .Int (15 ),
878+ MaxPodsPerNode : common .Int (31 ),
879879 NSGNames : []string {"pod-nsg" },
880880 },
881881 },
@@ -919,7 +919,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
919919 IsPvEncryptionInTransitEnabled : common .Bool (true ),
920920 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
921921 PodSubnetIds : []string {"pod-subnet-id" },
922- MaxPodsPerNode : common .Int (15 ),
922+ MaxPodsPerNode : common .Int (31 ),
923923 PodNsgIds : []string {"pod-nsg-id" },
924924 },
925925 },
@@ -989,6 +989,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
989989 ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
990990 ms .OCIManagedMachinePool .Name = "changed"
991991 ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
992+ Version : common .String ("v1.24.5" ),
992993 ID : common .String ("node-pool-id" ),
993994 NodeMetadata : map [string ]string {"key1" : "value1" },
994995 InitialNodeLabels : []infrav1exp.KeyValue {{
@@ -1020,7 +1021,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
10201021 CniType : infrav1exp .VCNNativeCNI ,
10211022 VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
10221023 SubnetNames : []string {"pod-subnet" },
1023- MaxPodsPerNode : common .Int (15 ),
1024+ MaxPodsPerNode : common .Int (31 ),
10241025 NSGNames : []string {"pod-nsg" },
10251026 },
10261027 },
@@ -1064,7 +1065,7 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
10641065 IsPvEncryptionInTransitEnabled : common .Bool (true ),
10651066 NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
10661067 PodSubnetIds : []string {"pod-subnet-id" },
1067- MaxPodsPerNode : common .Int (15 ),
1068+ MaxPodsPerNode : common .Int (31 ),
10681069 PodNsgIds : []string {"pod-nsg-id" },
10691070 },
10701071 },
@@ -1149,35 +1150,3 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
11491150 })
11501151 }
11511152}
1152-
1153- func allMatcher (request interface {}, request2 oke.CreateNodePoolRequest ) error {
1154- r , ok := request .(oke.CreateNodePoolRequest )
1155- if ! ok {
1156- return errors .New ("expecting LaunchInstanceRequest type" )
1157- }
1158- if ! reflect .DeepEqual (r .NodeEvictionNodePoolSettings , request2 .NodeEvictionNodePoolSettings ) {
1159- return errors .New (fmt .Sprintf ("node eviction mismatch" ))
1160- }
1161- if ! reflect .DeepEqual (r .NodeShapeConfig , request2 .NodeShapeConfig ) {
1162- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1163- }
1164- if ! reflect .DeepEqual (r .NodeConfigDetails .DefinedTags , request2 .NodeConfigDetails .DefinedTags ) {
1165- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1166- }
1167- if ! reflect .DeepEqual (r .NodeConfigDetails .Size , request2 .NodeConfigDetails .Size ) {
1168- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1169- }
1170- if ! reflect .DeepEqual (r .NodeConfigDetails .PlacementConfigs , request2 .NodeConfigDetails .PlacementConfigs ) {
1171- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1172- }
1173- if ! reflect .DeepEqual (r .NodeConfigDetails .FreeformTags , request2 .NodeConfigDetails .FreeformTags ) {
1174- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1175- }
1176- if ! reflect .DeepEqual (r .NodeConfigDetails .NodePoolPodNetworkOptionDetails , request2 .NodeConfigDetails .NodePoolPodNetworkOptionDetails ) {
1177- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1178- }
1179- if ! reflect .DeepEqual (r .NodeConfigDetails .NsgIds , request2 .NodeConfigDetails .NsgIds ) {
1180- return errors .New (fmt .Sprintf ("node shape mismatch" ))
1181- }
1182- return nil
1183- }
0 commit comments