@@ -606,6 +606,40 @@ var _ = Describe("Create MachinePool", ci.Day2, ci.NonHCPCluster, ci.FeatureMach
606
606
Expect (mpResponseBody .InstanceType ()).To (Equal ("m5.2xlarge" ))
607
607
})
608
608
609
+ It ("can create machinepool with customized tags - [id:73942]" , ci .High , ci .NonHCPCluster , func () {
610
+
611
+ By ("Create a machinepool with variable aws_tags" )
612
+ name := "mp-73942"
613
+ replicas := 0
614
+ machineType := "r5.xlarge"
615
+
616
+ validTags := map [string ]string {
617
+ "tagsKey" : "tagValue" ,
618
+ }
619
+ MachinePoolArgs := & exe.MachinePoolArgs {
620
+ Cluster : & clusterID ,
621
+ Replicas : & replicas ,
622
+ MachineType : & machineType ,
623
+ Name : & name ,
624
+ Tags : & validTags ,
625
+ }
626
+ _ , err := mpService .Apply (MachinePoolArgs , false )
627
+ Expect (err ).ToNot (HaveOccurred ())
628
+
629
+ By ("Check the machinepool detail state" )
630
+ resp , err := cms .RetrieveClusterMachinePool (ci .RHCSConnection , clusterID , name )
631
+ Expect (err ).ToNot (HaveOccurred ())
632
+ for tagKey , tagValue := range validTags {
633
+ Expect (tagValue ).To (BeElementOf (resp .AWS ().Tags ()[tagKey ]))
634
+ }
635
+
636
+ By ("Update the machinepool tags is not allowed" )
637
+ validTags ["tagKey2" ] = "tagValue2"
638
+ _ , err = mpService .Apply (MachinePoolArgs , false )
639
+ Expect (err ).To (HaveOccurred ())
640
+ Expect (err .Error ()).Should (ContainSubstring ("Attribute aws_tags, cannot be changed from" ))
641
+ })
642
+
609
643
It ("can reconciliate with basic flow - [id:65645]" , ci .Medium , func () {
610
644
By ("Create additional machinepool with taints" )
611
645
replicas := 3
@@ -648,6 +682,50 @@ var _ = Describe("Create MachinePool", ci.Day2, ci.NonHCPCluster, ci.FeatureMach
648
682
Expect (taint .Value ()).To (Equal (taints [index ]["value" ]))
649
683
}
650
684
})
685
+ It ("will validate well - [id:63139]" , ci .Medium , ci .NonHCPCluster , func () {
686
+ By ("Will validate the subnet" )
687
+ MachinePoolArgs := & exe.MachinePoolArgs {
688
+ Cluster : & clusterID ,
689
+ Replicas : h .IntPointer (0 ),
690
+ MachineType : h .StringPointer ("m5.xlarge" ),
691
+ Name : h .StringPointer ("invalidsub" ),
692
+ SubnetID : h .StringPointer ("subnet-invalidsubnetid" ),
693
+ }
694
+ output , err := mpService .Apply (MachinePoolArgs , false )
695
+ Expect (err ).To (HaveOccurred ())
696
+ Expect (output ).Should (ContainSubstring ("Failed to find subnet" ))
697
+
698
+ By ("Will validate the instance type" )
699
+ MachinePoolArgs = & exe.MachinePoolArgs {
700
+ Cluster : & clusterID ,
701
+ Replicas : h .IntPointer (0 ),
702
+ MachineType : h .StringPointer ("invalid" ),
703
+ Name : h .StringPointer ("invalidinstype" ),
704
+ }
705
+ output , err = mpService .Apply (MachinePoolArgs , false )
706
+ Expect (err ).To (HaveOccurred ())
707
+ Expect (output ).Should (MatchRegexp (`[\s\S]*Machine type 'invalid'[\n\\n\s\t]*is not supported for cloud provider` ))
708
+
709
+ By ("Create machinepool creation plan with invalid tags" )
710
+ invalidTags := map [string ]string {
711
+ "aws:tags" : "awsvalue" ,
712
+ }
713
+ replicas := 0
714
+ machineType := "r5.xlarge"
715
+ name := "mp-73942"
716
+
717
+ MachinePoolArgs = & exe.MachinePoolArgs {
718
+ Cluster : & clusterID ,
719
+ Replicas : & replicas ,
720
+ MachineType : & machineType ,
721
+ Name : & name ,
722
+ Tags : & invalidTags ,
723
+ }
724
+ output , err = mpService .Apply (MachinePoolArgs , false )
725
+ Expect (err ).To (HaveOccurred ())
726
+ Expect (output ).Should (ContainSubstring ("Tags that begin with 'aws:' are reserved" ))
727
+
728
+ })
651
729
})
652
730
653
731
var _ = Describe ("Import MachinePool" , ci .Day2 , ci .NonHCPCluster , ci .FeatureImport , func () {
0 commit comments