@@ -17,6 +17,7 @@ limitations under the License.
1717package controllers
1818
1919import (
20+ "fmt"
2021 "testing"
2122
2223 "github.com/hetznercloud/hcloud-go/v2/hcloud"
@@ -346,7 +347,7 @@ var _ = Describe("HCloudMachineReconciler", func() {
346347 },
347348 Spec : infrav1.HCloudMachineSpec {
348349 ImageName : "my-control-plane" ,
349- Type : "cpx31 " ,
350+ Type : "cpx32 " ,
350351 PlacementGroupName : & defaultPlacementGroupName ,
351352 },
352353 }
@@ -387,9 +388,23 @@ var _ = Describe("HCloudMachineReconciler", func() {
387388
388389 By ("checking that bootstrap condition is not ready" )
389390
390- Eventually (func () bool {
391- return isPresentAndFalseWithReason (key , hcloudMachine , infrav1 .BootstrapReadyCondition , infrav1 .BootstrapNotReadyReason )
392- }, timeout , interval ).Should (BeTrue ())
391+ Eventually (func () error {
392+ err := testEnv .Get (ctx , client .ObjectKeyFromObject (hcloudMachine ), hcloudMachine )
393+ if err != nil {
394+ return err
395+ }
396+ c := conditions .Get (hcloudMachine , infrav1 .BootstrapReadyCondition )
397+ if c == nil {
398+ return fmt .Errorf ("BootstrapReadyCondition not set" )
399+ }
400+ if c .Status != corev1 .ConditionFalse {
401+ return fmt .Errorf ("BootstrapReadyCondition not false" )
402+ }
403+ if c .Reason != infrav1 .BootstrapNotReadyReason {
404+ return fmt .Errorf ("BootstrapNotReadyReason not set. Reason: %q" , c .Reason )
405+ }
406+ return nil
407+ }, timeout , interval ).Should (Succeed ())
393408
394409 By ("setting the bootstrap data" )
395410
@@ -479,7 +494,7 @@ var _ = Describe("HCloudMachineReconciler", func() {
479494 },
480495 Spec : infrav1.HCloudMachineSpec {
481496 ImageName : "my-control-plane-2" ,
482- Type : "cpx31 " ,
497+ Type : "cpx32 " ,
483498 PlacementGroupName : & defaultPlacementGroupName ,
484499 },
485500 }
@@ -523,7 +538,7 @@ var _ = Describe("HCloudMachineReconciler", func() {
523538 },
524539 Spec : infrav1.HCloudMachineSpec {
525540 ImageName : "my-control-plane" ,
526- Type : "cpx31 " ,
541+ Type : "cpx32 " ,
527542 PlacementGroupName : & defaultPlacementGroupName ,
528543 },
529544 }
@@ -613,6 +628,24 @@ var _ = Describe("HCloudMachineReconciler", func() {
613628 EnableIPv6 : false ,
614629 }
615630 Expect (testEnv .Create (ctx , hetznerCluster )).To (Succeed ())
631+ Eventually (func () bool {
632+ var updatedCluster infrav1.HetznerCluster
633+ if err := testEnv .Get (ctx , client .ObjectKeyFromObject (hetznerCluster ), & updatedCluster ); err != nil {
634+ return false
635+ }
636+
637+ if updatedCluster .Spec .ControlPlaneEndpoint == nil {
638+ return false
639+ }
640+ if updatedCluster .Status .ControlPlaneLoadBalancer == nil {
641+ return false
642+ }
643+ if updatedCluster .Status .ControlPlaneLoadBalancer .IPv4 == "" {
644+ return false
645+ }
646+
647+ return updatedCluster .Spec .ControlPlaneEndpoint .Host == updatedCluster .Status .ControlPlaneLoadBalancer .IPv4
648+ }, timeout , interval ).Should (BeTrue ())
616649 Expect (testEnv .Create (ctx , hcloudMachine )).To (Succeed ())
617650 })
618651
@@ -740,7 +773,7 @@ var _ = Describe("Hetzner secret", func() {
740773 },
741774 Spec : infrav1.HCloudMachineSpec {
742775 ImageName : "my-control-plane" ,
743- Type : "cpx31 " ,
776+ Type : "cpx32 " ,
744777 PlacementGroupName : & defaultPlacementGroupName ,
745778 },
746779 }
@@ -816,7 +849,7 @@ var _ = Describe("HCloudMachine validation", func() {
816849 },
817850 Spec : infrav1.HCloudMachineSpec {
818851 ImageName : "my-control-plane" ,
819- Type : "cpx31 " ,
852+ Type : "cpx32 " ,
820853 },
821854 }
822855 })
@@ -842,7 +875,7 @@ var _ = Describe("HCloudMachine validation", func() {
842875 return testEnv .Client .Get (ctx , key , hcloudMachine )
843876 }, timeout , interval ).Should (BeNil ())
844877
845- hcloudMachine .Spec .Type = "cpx32 "
878+ hcloudMachine .Spec .Type = "cpx42 "
846879 hcloudMachine .Spec .ImageName = "my-control-plane"
847880 Expect (testEnv .Update (ctx , hcloudMachine )).ToNot (Succeed ())
848881 })
0 commit comments