talos
talos copied to clipboard
test: add a test for watchdog timers
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 helpfor a description of the available targets.
I'm going to take a look into this to add more generic helpers to help with patching machine configuration.
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)
$ _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
/ok-to-test
Thanks a lot for your help, will see and do anything else to be done if anything tomorrow
/m