Skip to content

Commit b88f27d

Browse files
committed
chore: make reset test code a bit better
Simplify the reset test code. Signed-off-by: Noel Georgi <[email protected]>
1 parent 1cde53d commit b88f27d

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

internal/integration/api/apply-config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ func (suite *ApplyConfigSuite) TestApply() {
144144
suite.Assert().Equal(
145145
newProvider.Machine().Sysctls()[applyConfigTestSysctl],
146146
applyConfigTestSysctlVal,
147+
"expected sysctl %s to be set to %s, got %s on node %q",
148+
applyConfigTestSysctl, applyConfigTestSysctlVal, newProvider.Machine().Sysctls()[applyConfigTestSysctl], node,
147149
)
148150
}
149151

internal/integration/base/api.go

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -304,22 +304,11 @@ func (apiSuite *APISuite) AssertRebootedNoChecks(ctx context.Context, node strin
304304

305305
nodeCtx := client.WithNode(ctx, node)
306306

307-
var (
308-
bootIDBefore string
309-
err error
310-
)
311-
312-
err = retry.Constant(time.Minute * 5).Retry(func() error {
313-
// read boot_id before reboot
314-
bootIDBefore, err = apiSuite.ReadBootID(nodeCtx)
315-
if err != nil {
316-
return retry.ExpectedError(err)
317-
}
318-
319-
return nil
320-
})
307+
// read boot_id before reboot
308+
bootIDBefore, err := apiSuite.ReadBootID(nodeCtx)
309+
apiSuite.Require().NoError(err, "failed to read boot_id before reboot")
321310

322-
apiSuite.Require().NoError(err)
311+
apiSuite.Assert().NotEmpty(bootIDBefore, "boot_id should not be empty")
323312

324313
apiSuite.Assert().NoError(rebootFunc(nodeCtx))
325314

@@ -328,8 +317,6 @@ func (apiSuite *APISuite) AssertRebootedNoChecks(ctx context.Context, node strin
328317

329318
// AssertBootIDChanged waits until node boot id changes.
330319
func (apiSuite *APISuite) AssertBootIDChanged(nodeCtx context.Context, bootIDBefore, node string, timeout time.Duration) {
331-
apiSuite.Assert().NotEmpty(bootIDBefore)
332-
333320
apiSuite.Require().NoError(retry.Constant(timeout).Retry(func() error {
334321
requestCtx, requestCtxCancel := context.WithTimeout(nodeCtx, time.Second)
335322
defer requestCtxCancel()

0 commit comments

Comments
 (0)