test: fix readyToUse flag assertions in static infra provider tests
Some checks failed
default / default (push) Waiting to run
default / e2e-backups (push) Blocked by required conditions
default / e2e-forced-removal (push) Blocked by required conditions
default / e2e-scaling (push) Blocked by required conditions
default / e2e-short (push) Blocked by required conditions
default / e2e-short-secureboot (push) Blocked by required conditions
default / e2e-templates (push) Blocked by required conditions
default / e2e-upgrades (push) Blocked by required conditions
default / e2e-workload-proxy (push) Blocked by required conditions
e2e-workload-proxy-cron / default (push) Has been cancelled
e2e-upgrades-cron / default (push) Has been cancelled
e2e-templates-cron / default (push) Has been cancelled
e2e-short-secureboot-cron / default (push) Has been cancelled
e2e-short-cron / default (push) Has been cancelled
e2e-scaling-cron / default (push) Has been cancelled
e2e-forced-removal-cron / default (push) Has been cancelled
e2e-backups-cron / default (push) Has been cancelled

Change the assertions to work with the new, changed behavior of the `infraMachineStatus.readyToUse` flag.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
Utku Ozdemir 2025-01-22 22:25:04 +01:00
parent 4a436b4102
commit 8db0e8d7c0
No known key found for this signature in database
GPG Key ID: DBD13117B0A14E93
4 changed files with 16 additions and 13 deletions

View File

@ -477,11 +477,12 @@ func (x *InfraMachineStateSpec) GetInstalled() bool {
}
type InfraMachineStatusSpec struct {
state protoimpl.MessageState `protogen:"open.v1"`
PowerState InfraMachineStatusSpec_MachinePowerState `protobuf:"varint,1,opt,name=power_state,json=powerState,proto3,enum=specs.InfraMachineStatusSpec_MachinePowerState" json:"power_state,omitempty"`
ReadyToUse bool `protobuf:"varint,2,opt,name=ready_to_use,json=readyToUse,proto3" json:"ready_to_use,omitempty"`
LastRebootId string `protobuf:"bytes,3,opt,name=last_reboot_id,json=lastRebootId,proto3" json:"last_reboot_id,omitempty"`
LastRebootTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=last_reboot_timestamp,json=lastRebootTimestamp,proto3" json:"last_reboot_timestamp,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
PowerState InfraMachineStatusSpec_MachinePowerState `protobuf:"varint,1,opt,name=power_state,json=powerState,proto3,enum=specs.InfraMachineStatusSpec_MachinePowerState" json:"power_state,omitempty"`
// ReadyToUse is set to true when the machine is not dirty, i.e., there is no pending wipe operation.
ReadyToUse bool `protobuf:"varint,2,opt,name=ready_to_use,json=readyToUse,proto3" json:"ready_to_use,omitempty"`
LastRebootId string `protobuf:"bytes,3,opt,name=last_reboot_id,json=lastRebootId,proto3" json:"last_reboot_id,omitempty"`
LastRebootTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=last_reboot_timestamp,json=lastRebootTimestamp,proto3" json:"last_reboot_timestamp,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}

View File

@ -63,6 +63,8 @@ message InfraMachineStatusSpec {
}
MachinePowerState power_state = 1;
// ReadyToUse is set to true when the machine is not dirty, i.e., there is no pending wipe operation.
bool ready_to_use = 2;
string last_reboot_id = 3;
google.protobuf.Timestamp last_reboot_timestamp = 4;

View File

@ -299,10 +299,10 @@ func AssertInfraMachinesAreAllocated(testCtx context.Context, omniState state.St
assertion.Equal(extensions, res.TypedSpec().Value.Extensions)
})
// The machine is allocated, so the ReadyToUse field is set to false
// The machine is allocated, so it will be powered on and be ready to use
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
assertion.Equal(specs.InfraMachineStatusSpec_POWER_STATE_ON, res.TypedSpec().Value.PowerState)
assertion.False(res.TypedSpec().Value.ReadyToUse)
assertion.True(res.TypedSpec().Value.ReadyToUse)
})
// Omni receives a SequenceEvent from the SideroLink event sink and sets the Installed field to true
@ -338,15 +338,15 @@ func AssertAllInfraMachinesAreUnallocated(testCtx context.Context, omniState sta
}
})
// machine is unallocated, so the ReadyToUse field will be set to true
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
assertion.True(res.TypedSpec().Value.ReadyToUse)
})
// provider wipes the machine and sets the Installed field to false
rtestutils.AssertResource[*infra.MachineState](ctx, t, omniState, id, func(res *infra.MachineState, assertion *assert.Assertions) {
assertion.False(res.TypedSpec().Value.Installed)
})
// after the machine is wiped, ReadyToUse field will be set to true
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
assertion.True(res.TypedSpec().Value.ReadyToUse)
})
}
}
}

View File

@ -1 +1 @@
v0.46.0-beta.0
v0.46.0-beta.0