Skip to content

Commit

Permalink
test: fix readyToUse flag assertions in static infra provider tests
Browse files Browse the repository at this point in the history
Change the assertions to work with the new, changed behavior of the `infraMachineStatus.readyToUse` flag.

Signed-off-by: Utku Ozdemir <[email protected]>
  • Loading branch information
utkuozdemir committed Jan 22, 2025
1 parent 4a436b4 commit 8db0e8d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
11 changes: 6 additions & 5 deletions client/api/omni/specs/infra.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client/api/omni/specs/infra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions cmd/integration-test/pkg/tests/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/version/data/tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.46.0-beta.0
v0.46.0-beta.0

0 comments on commit 8db0e8d

Please sign in to comment.