@@ -35,7 +35,7 @@ import (
3535 "sigs.k8s.io/cluster-api/util/conditions"
3636 v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1"
3737 "sigs.k8s.io/cluster-api/util/kubeconfig"
38- builder "sigs.k8s.io/cluster-api/util/test/builder"
38+ "sigs.k8s.io/cluster-api/util/test/builder"
3939)
4040
4141func TestSetBootstrapReadyCondition (t * testing.T ) {
@@ -1439,6 +1439,11 @@ func TestSetReadyCondition(t *testing.T) {
14391439 Status : metav1 .ConditionFalse ,
14401440 Reason : clusterv1 .MachineNotDeletingReason ,
14411441 },
1442+ {
1443+ Type : clusterv1 .MachineUpdatingCondition ,
1444+ Status : metav1 .ConditionFalse ,
1445+ Reason : clusterv1 .MachineNotUpdatingReason ,
1446+ },
14421447 },
14431448 },
14441449 },
@@ -1479,6 +1484,11 @@ func TestSetReadyCondition(t *testing.T) {
14791484 Reason : clusterv1 .MachineDeletingWaitingForPreDrainHookReason ,
14801485 Message : "Waiting for pre-drain hooks to succeed (hooks: test-hook)" ,
14811486 },
1487+ {
1488+ Type : clusterv1 .MachineUpdatingCondition ,
1489+ Status : metav1 .ConditionFalse ,
1490+ Reason : clusterv1 .MachineNotUpdatingReason ,
1491+ },
14821492 },
14831493 },
14841494 },
@@ -1489,6 +1499,51 @@ func TestSetReadyCondition(t *testing.T) {
14891499 Message : "* Deleting: Machine deletion in progress, stage: WaitingForPreDrainHook" ,
14901500 },
14911501 },
1502+ {
1503+ name : "Aggregates Ready condition correctly while the machine is updating" ,
1504+ machine : & clusterv1.Machine {
1505+ ObjectMeta : metav1.ObjectMeta {
1506+ Name : "machine-test" ,
1507+ Namespace : metav1 .NamespaceDefault ,
1508+ },
1509+ Status : clusterv1.MachineStatus {
1510+ Conditions : []metav1.Condition {
1511+ {
1512+ Type : clusterv1 .MachineBootstrapConfigReadyCondition ,
1513+ Status : metav1 .ConditionTrue ,
1514+ Reason : "Foo" ,
1515+ },
1516+ {
1517+ Type : clusterv1 .InfrastructureReadyCondition ,
1518+ Status : metav1 .ConditionTrue ,
1519+ Reason : "Foo" ,
1520+ },
1521+ {
1522+ Type : clusterv1 .MachineNodeHealthyCondition ,
1523+ Status : metav1 .ConditionTrue ,
1524+ Reason : "Foo" ,
1525+ },
1526+ {
1527+ Type : clusterv1 .MachineDeletingCondition ,
1528+ Status : metav1 .ConditionFalse ,
1529+ Reason : clusterv1 .MachineNotDeletingReason ,
1530+ },
1531+ {
1532+ Type : clusterv1 .MachineUpdatingCondition ,
1533+ Status : metav1 .ConditionTrue ,
1534+ Reason : clusterv1 .MachineInPlaceUpdatingReason ,
1535+ Message : "In place update in progress" ,
1536+ },
1537+ },
1538+ },
1539+ },
1540+ expectCondition : metav1.Condition {
1541+ Type : clusterv1 .MachineReadyCondition ,
1542+ Status : metav1 .ConditionFalse ,
1543+ Reason : clusterv1 .MachineNotReadyReason ,
1544+ Message : "* Updating: In place update in progress" ,
1545+ },
1546+ },
14921547 {
14931548 name : "Aggregates Ready condition correctly while the machine is deleting (waiting for Node drain)" ,
14941549 machine : & clusterv1.Machine {
@@ -1528,6 +1583,11 @@ func TestSetReadyCondition(t *testing.T) {
15281583 * some other error 4: pod-9-to-trigger-eviction-some-other-error
15291584 * ... (1 more error applying to 1 Pod)` ,
15301585 },
1586+ {
1587+ Type : clusterv1 .MachineUpdatingCondition ,
1588+ Status : metav1 .ConditionFalse ,
1589+ Reason : clusterv1 .MachineNotUpdatingReason ,
1590+ },
15311591 },
15321592 },
15331593 },
@@ -1573,6 +1633,11 @@ func TestSetReadyCondition(t *testing.T) {
15731633 Status : metav1 .ConditionFalse ,
15741634 Reason : clusterv1 .MachineNotDeletingReason ,
15751635 },
1636+ {
1637+ Type : clusterv1 .MachineUpdatingCondition ,
1638+ Status : metav1 .ConditionFalse ,
1639+ Reason : clusterv1 .MachineNotUpdatingReason ,
1640+ },
15761641 },
15771642 },
15781643 },
@@ -1640,6 +1705,11 @@ func TestSetReadyCondition(t *testing.T) {
16401705 Status : metav1 .ConditionFalse ,
16411706 Reason : clusterv1 .MachineNotDeletingReason ,
16421707 },
1708+ {
1709+ Type : clusterv1 .MachineUpdatingCondition ,
1710+ Status : metav1 .ConditionFalse ,
1711+ Reason : clusterv1 .MachineNotUpdatingReason ,
1712+ },
16431713 },
16441714 },
16451715 },
@@ -1710,6 +1780,11 @@ func TestSetReadyCondition(t *testing.T) {
17101780 Status : metav1 .ConditionFalse ,
17111781 Reason : clusterv1 .MachineNotDeletingReason ,
17121782 },
1783+ {
1784+ Type : clusterv1 .MachineUpdatingCondition ,
1785+ Status : metav1 .ConditionFalse ,
1786+ Reason : clusterv1 .MachineNotUpdatingReason ,
1787+ },
17131788 },
17141789 },
17151790 },
0 commit comments