Skip to content

Commit

Permalink
test: further improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
  • Loading branch information
dsseng committed May 6, 2024
1 parent 5892ea4 commit 0d5338f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/integration/api/watchdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/cosi-project/runtime/pkg/state"

"github.com/cosi-project/runtime/pkg/resource"
"github.com/siderolabs/talos/internal/integration/base"
"github.com/siderolabs/talos/pkg/machinery/client"
"github.com/siderolabs/talos/pkg/machinery/config/types/runtime"
Expand Down Expand Up @@ -76,7 +77,7 @@ func (suite *WatchdogSuite) TestWatchdogSysfs() {
const watchdog = "watchdog0"

cfgDocument := runtime.NewWatchdogTimerV1Alpha1()
cfgDocument.WatchdogDevice = "/dev/watchdog0"
cfgDocument.WatchdogDevice = "/dev/" + watchdog
cfgDocument.WatchdogTimeout = 120 * time.Second

// deactivate the watchdog
Expand Down Expand Up @@ -105,9 +106,21 @@ func (suite *WatchdogSuite) TestWatchdogSysfs() {
wdState = suite.readWatchdogSysfs(nodeCtx, watchdog, "state")
suite.Require().Equal("active", wdState)

state.WithCondition(func(r resource.Resource) (bool, error) {
return (r.(*runtimeres.WatchdogTimerStatus).TypedSpec().Timeout == 1*time.Minute), nil
})
wdTimeout = suite.readWatchdogSysfs(nodeCtx, watchdog, "timeout")
suite.Require().Equal("60", wdTimeout)

cfgDocument.WatchdogTimeout = 90 * time.Second
suite.PatchMachineConfig(nodeCtx, cfgDocument)

state.WithCondition(func(r resource.Resource) (bool, error) {
return (r.(*runtimeres.WatchdogTimerStatus).TypedSpec().Timeout == 90*time.Second), nil
})
wdTimeout = suite.readWatchdogSysfs(nodeCtx, watchdog, "timeout")
suite.Require().Equal("90", wdTimeout)

// deactivate the watchdog
suite.RemoveMachineConfigDocuments(nodeCtx, cfgDocument.MetaKind)

Expand Down

0 comments on commit 0d5338f

Please sign in to comment.