From 0d5338fc32c29568caf4897130c41c16855b99d0 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Mon, 6 May 2024 09:30:30 +0300 Subject: [PATCH] test: further improvements Signed-off-by: Dmitry Sharshakov --- internal/integration/api/watchdog.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/integration/api/watchdog.go b/internal/integration/api/watchdog.go index ce0a7f05b14..e2a7535ce58 100644 --- a/internal/integration/api/watchdog.go +++ b/internal/integration/api/watchdog.go @@ -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" @@ -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 @@ -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)