@@ -605,7 +605,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) {
605
605
expectError : true ,
606
606
},
607
607
{
608
- name : "existing machinepool, bootstrap data should not change " ,
608
+ name : "existing machinepool with config ref, update data secret name " ,
609
609
bootstrapConfig : map [string ]interface {}{
610
610
"kind" : builder .TestBootstrapConfigKind ,
611
611
"apiVersion" : builder .BootstrapGroupVersion .String (),
@@ -643,6 +643,45 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) {
643
643
},
644
644
},
645
645
expectError : false ,
646
+ expected : func (g * WithT , m * expv1.MachinePool ) {
647
+ g .Expect (m .Status .BootstrapReady ).To (BeTrue ())
648
+ g .Expect (* m .Spec .Template .Spec .Bootstrap .DataSecretName ).To (Equal ("secret-data" ))
649
+ },
650
+ },
651
+ {
652
+ name : "existing machinepool without config ref, do not update data secret name" ,
653
+ bootstrapConfig : map [string ]interface {}{
654
+ "kind" : builder .TestBootstrapConfigKind ,
655
+ "apiVersion" : builder .BootstrapGroupVersion .String (),
656
+ "metadata" : map [string ]interface {}{
657
+ "name" : "bootstrap-config1" ,
658
+ "namespace" : metav1 .NamespaceDefault ,
659
+ },
660
+ "spec" : map [string ]interface {}{},
661
+ "status" : map [string ]interface {}{
662
+ "ready" : true ,
663
+ "dataSecretName" : "secret-data" ,
664
+ },
665
+ },
666
+ machinepool : & expv1.MachinePool {
667
+ ObjectMeta : metav1.ObjectMeta {
668
+ Name : "bootstrap-test-existing" ,
669
+ Namespace : metav1 .NamespaceDefault ,
670
+ },
671
+ Spec : expv1.MachinePoolSpec {
672
+ Template : clusterv1.MachineTemplateSpec {
673
+ Spec : clusterv1.MachineSpec {
674
+ Bootstrap : clusterv1.Bootstrap {
675
+ DataSecretName : pointer .String ("data" ),
676
+ },
677
+ },
678
+ },
679
+ },
680
+ Status : expv1.MachinePoolStatus {
681
+ BootstrapReady : true ,
682
+ },
683
+ },
684
+ expectError : false ,
646
685
expected : func (g * WithT , m * expv1.MachinePool ) {
647
686
g .Expect (m .Status .BootstrapReady ).To (BeTrue ())
648
687
g .Expect (* m .Spec .Template .Spec .Bootstrap .DataSecretName ).To (Equal ("data" ))
0 commit comments