Skip to content

Commit 8db0e8d

Browse files
committed
test: fix readyToUse flag assertions in static infra provider tests
Change the assertions to work with the new, changed behavior of the `infraMachineStatus.readyToUse` flag. Signed-off-by: Utku Ozdemir <[email protected]>
1 parent 4a436b4 commit 8db0e8d

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

client/api/omni/specs/infra.pb.go

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/api/omni/specs/infra.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ message InfraMachineStatusSpec {
6363
}
6464

6565
MachinePowerState power_state = 1;
66+
67+
// ReadyToUse is set to true when the machine is not dirty, i.e., there is no pending wipe operation.
6668
bool ready_to_use = 2;
6769
string last_reboot_id = 3;
6870
google.protobuf.Timestamp last_reboot_timestamp = 4;

cmd/integration-test/pkg/tests/infra.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ func AssertInfraMachinesAreAllocated(testCtx context.Context, omniState state.St
299299
assertion.Equal(extensions, res.TypedSpec().Value.Extensions)
300300
})
301301

302-
// The machine is allocated, so the ReadyToUse field is set to false
302+
// The machine is allocated, so it will be powered on and be ready to use
303303
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
304304
assertion.Equal(specs.InfraMachineStatusSpec_POWER_STATE_ON, res.TypedSpec().Value.PowerState)
305-
assertion.False(res.TypedSpec().Value.ReadyToUse)
305+
assertion.True(res.TypedSpec().Value.ReadyToUse)
306306
})
307307

308308
// 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
338338
}
339339
})
340340

341-
// machine is unallocated, so the ReadyToUse field will be set to true
342-
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
343-
assertion.True(res.TypedSpec().Value.ReadyToUse)
344-
})
345-
346341
// provider wipes the machine and sets the Installed field to false
347342
rtestutils.AssertResource[*infra.MachineState](ctx, t, omniState, id, func(res *infra.MachineState, assertion *assert.Assertions) {
348343
assertion.False(res.TypedSpec().Value.Installed)
349344
})
345+
346+
// after the machine is wiped, ReadyToUse field will be set to true
347+
rtestutils.AssertResource[*infra.MachineStatus](ctx, t, omniState, id, func(res *infra.MachineStatus, assertion *assert.Assertions) {
348+
assertion.True(res.TypedSpec().Value.ReadyToUse)
349+
})
350350
}
351351
}
352352
}

internal/version/data/tag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.46.0-beta.0
1+
v0.46.0-beta.0

0 commit comments

Comments
 (0)