Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ func TestReconcileNormalEtcd(t *testing.T) {
r.InMemoryManager.AddResourceGroup(klog.KObj(cluster).String())
c := r.InMemoryManager.GetResourceGroup(klog.KObj(cluster).String()).GetClient()

// Note: We have to update the lastTransitionTime of the NodeProvisioned condition
// to ensure provisioning time is not expired yet.
updateNodeProvisionedTime(inMemoryMachineWithNodeProvisioned1)
res, err := r.reconcileNormalETCD(ctx, cluster, cpMachine, inMemoryMachineWithNodeProvisioned1)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(res.IsZero()).To(BeFalse())
Expand Down Expand Up @@ -610,6 +613,9 @@ func TestReconcileNormalApiServer(t *testing.T) {
r.InMemoryManager.AddResourceGroup(klog.KObj(cluster).String())
c := r.InMemoryManager.GetResourceGroup(klog.KObj(cluster).String()).GetClient()

// Note: We have to update the lastTransitionTime of the NodeProvisioned condition
// to ensure provisioning time is not expired yet.
updateNodeProvisionedTime(inMemoryMachineWithNodeProvisioned)
res, err := r.reconcileNormalAPIServer(ctx, cluster, cpMachine, inMemoryMachineWithNodeProvisioned)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(res.IsZero()).To(BeFalse())
Expand Down Expand Up @@ -845,3 +851,21 @@ func newSelfSignedCACert(key *rsa.PrivateKey) (*x509.Certificate, error) {
c, err := x509.ParseCertificate(b)
return c, errors.WithStack(err)
}

func updateNodeProvisionedTime(machine *infrav1.DevMachine) {
for i := range machine.Status.Conditions {
if machine.Status.Conditions[i].Type == string(infrav1.NodeProvisionedCondition) {
machine.Status.Conditions[i].LastTransitionTime = metav1.Now()
return
}
}

if machine.Status.Deprecated != nil && machine.Status.Deprecated.V1Beta1 != nil {
for i := range machine.Status.Deprecated.V1Beta1.Conditions {
if machine.Status.Deprecated.V1Beta1.Conditions[i].Type == infrav1.NodeProvisionedCondition {
machine.Status.Deprecated.V1Beta1.Conditions[i].LastTransitionTime = metav1.Now()
return
}
}
}
}