talos icon indicating copy to clipboard operation
talos copied to clipboard

test: add a test for watchdog timers

Open dsseng opened this issue 1 year ago • 5 comments

Pull Request

What? (description)

Add a test for watchdog

Why? (reasoning)

Ensure integration tests cover all code

Acceptance

Please use the following checklist:

  • [ ] you linked an issue (if applicable)
  • [x] you included tests (if applicable)
  • [ ] you ran conformance (make conformance)
  • [x] you formatted your code (make fmt)
  • [x] you linted your code (make lint)
  • [ ] you generated documentation (make docs)
  • [ ] you ran unit-tests (make unit-tests)

See make help for a description of the available targets.

dsseng avatar Apr 22 '24 15:04 dsseng

I'm going to take a look into this to add more generic helpers to help with patching machine configuration.

smira avatar Apr 23 '24 19:04 smira

Feedback/notes:

  • we should use test: for changes around tests
  • I added some base helpers to help with patching - the easiest is to use strategic merge config patches to update/add multi-doc machine config documents.
  • it's always better to use native types than to build YAML as bytes manually
  • after applying machine config we can't expect immediate change being applied, as controllers work async - so we use controller output resources as a signal that the work has been done
  • extract common helper to read watchdog properties
  • checking for provisioner type was wrong (I know it's a copy-paste from other place which I already fixed)

smira avatar Apr 23 '24 20:04 smira

$ _out/integration-test-linux-amd64 -test.v -talos.crashdump=false -talos.provisioner=qemu -talos.talosctlpath=$PWD/_out/talosctl-linux-amd64 -test.run TestIntegration/api.Watch
=== RUN   TestIntegration
=== RUN   TestIntegration/api.WatchdogSuite
=== RUN   TestIntegration/api.WatchdogSuite/TestWatchdogSysfs
    watchdog.go:69: testing watchdog on node 172.20.0.2
    api.go:593: patched machine config: Applied configuration without a reboot
    api.go:593: patched machine config: Applied configuration without a reboot
--- PASS: TestIntegration (0.30s)
    --- PASS: TestIntegration/api.WatchdogSuite (0.29s)
        --- PASS: TestIntegration/api.WatchdogSuite/TestWatchdogSysfs (0.14s)
PASS

smira avatar Apr 23 '24 20:04 smira

/ok-to-test

smira avatar Apr 23 '24 20:04 smira

Thanks a lot for your help, will see and do anything else to be done if anything tomorrow

dsseng avatar Apr 23 '24 20:04 dsseng

/m

smira avatar May 28 '24 13:05 smira