Skip to content

Commit

Permalink
review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Nov 22, 2024
1 parent fedf8c4 commit 55751bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/controllers/cluster/cluster_controller_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ func (s machinesConditionSetter) setMachinesCondition(ctx context.Context, clust
},
)
if err != nil {
log.Error(err, "Failed to aggregate Machine's Ready conditions")
log.Error(err, fmt.Sprintf("Failed to aggregate Machine's %s conditions", s.condition))
v1beta2conditions.Set(cluster, metav1.Condition{
Type: s.condition,
Status: metav1.ConditionUnknown,
Expand Down
22 changes: 11 additions & 11 deletions internal/controllers/cluster/cluster_controller_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ func TestSetControlPlaneMachinesUpToDateCondition(t *testing.T) {
name: "One machine up-to-date",
cluster: fakeCluster("c"),
machines: []*clusterv1.Machine{
fakeMachine("up-to-date-1", v1beta2Condition(metav1.Condition{
fakeMachine("up-to-date-1", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: "some-reason-1",
Expand All @@ -1055,7 +1055,7 @@ func TestSetControlPlaneMachinesUpToDateCondition(t *testing.T) {
name: "One machine unknown",
cluster: fakeCluster("c"),
machines: []*clusterv1.Machine{
fakeMachine("unknown-1", v1beta2Condition(metav1.Condition{
fakeMachine("unknown-1", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: "some-unknown-reason-1",
Expand All @@ -1074,7 +1074,7 @@ func TestSetControlPlaneMachinesUpToDateCondition(t *testing.T) {
name: "One machine not up-to-date",
cluster: fakeCluster("c"),
machines: []*clusterv1.Machine{
fakeMachine("not-up-to-date-machine-1", v1beta2Condition(metav1.Condition{
fakeMachine("not-up-to-date-machine-1", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: "some-not-up-to-date-reason",
Expand All @@ -1093,8 +1093,8 @@ func TestSetControlPlaneMachinesUpToDateCondition(t *testing.T) {
name: "One machine without up-to-date condition, one new Machines without up-to-date condition",
cluster: fakeCluster("c"),
machines: []*clusterv1.Machine{
fakeMachine("no-condition-machine-1"),
fakeMachine("no-condition-machine-2-new", creationTimestamp{Time: time.Now().Add(-5 * time.Second)}), // ignored because it's new
fakeMachine("no-condition-machine-1", controlPlane(true)),
fakeMachine("no-condition-machine-2-new", controlPlane(true), creationTimestamp{Time: time.Now().Add(-5 * time.Second)}), // ignored because it's new
},
getDescendantsSucceeded: true,
expectCondition: metav1.Condition{
Expand All @@ -1108,30 +1108,30 @@ func TestSetControlPlaneMachinesUpToDateCondition(t *testing.T) {
name: "Two machines not up-to-date, two up-to-date, two not reported",
cluster: fakeCluster("c"),
machines: []*clusterv1.Machine{
fakeMachine("up-to-date-1", v1beta2Condition(metav1.Condition{
fakeMachine("up-to-date-1", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: "TestUpToDate",
})),
fakeMachine("up-to-date-2", v1beta2Condition(metav1.Condition{
fakeMachine("up-to-date-2", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: "TestUpToDate",
})),
fakeMachine("not-up-to-date-machine-1", v1beta2Condition(metav1.Condition{
fakeMachine("not-up-to-date-machine-1", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: "TestNotUpToDate",
Message: "This is not up-to-date message",
})),
fakeMachine("not-up-to-date-machine-2", v1beta2Condition(metav1.Condition{
fakeMachine("not-up-to-date-machine-2", controlPlane(true), v1beta2Condition(metav1.Condition{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: "TestNotUpToDate",
Message: "This is not up-to-date message",
})),
fakeMachine("no-condition-machine-1"),
fakeMachine("no-condition-machine-2"),
fakeMachine("no-condition-machine-1", controlPlane(true)),
fakeMachine("no-condition-machine-2", controlPlane(true)),
},
getDescendantsSucceeded: true,
expectCondition: metav1.Condition{
Expand Down

0 comments on commit 55751bf

Please sign in to comment.