12 Commits

Author SHA1 Message Date
Jan Čermák
a3b0232351
Add landing page test to the basic test set (#3928)
We check that landing page is working when the network is down but we don't
check it in the happy path. Add its test to make it more obvious when the
just landing page is broken.
2025-03-17 11:23:04 +01:00
Jan Čermák
4a1d2b75b9
Improve tests traceability, add test for Systemd dependency cycles (#3917)
* Add test checking journal logs for dependency cycles
* Run some test cases to get their output also when full init fails
* Remove high timeouts from the times when GHA couldn't use KVM
* Enable logging durations for future optimizations
2025-03-06 18:23:34 +01:00
Jan Čermák
d42e34f646
Make swap size configurable (#3882)
Allow configuration of the swap size via /etc/default/haos-swapfile file. By
setting the SWAPSIZE variable in this file, swapfile get recreated on the next
reboot to the defined size. Size can be either in bytes or with optional units
(B/K/M/G, accepting some variations but always interpreted as power of 10). The
size is then rounded to 4k block size. If no override is defined or the value
can't be parsed, it falls back to previously used 33% of system RAM.

Fixes #968
2025-02-19 15:33:04 +01:00
Jan Čermák
8233cb94cd
Fix kernel tainted test (#3818)
I have only tested that it fails for unreleased 6.6.72 kernel but haven't
tested the happy path and missed that it also failed because the types were
different. Stupid me.
2025-01-21 22:41:53 +01:00
Jan Čermák
ca02ed000b
Add check for tainted kernel to automatic tests (#3814)
Add test that the kernel isn't tainted at the end of the basic and supervisor
test suites, allowing us to catch e.g. kernel warnings that may left unnoticed
if dmesg isn't checked. There is no other source of tainting, so the value
should be always zero.
2025-01-21 16:55:49 +01:00
Jan Čermák
5d164b12d1
Add test for no failed Systemd units (#3583)
Test that systemctl reports no failed units at the end of the basic test.
2024-09-11 23:30:01 +02:00
Jan Čermák
66fc7d7e2a
Test landing page is reachable without internet connection (#3499)
* Test landing page is reachable without internet connection

Add test that checks user is able to access the landing page even when HAOS has
no internet connection. We still need some sort of outgoing connectivity, so
outgoing connection attempts don't end up with "network is unreachable". To
simulate this, restricted network is created for the QEMU instance used in the
test, and when everything is started, unresponsive default gateway is added.

This intents to test regression that was fixed by
home-assistant/supervisor#5204, Supervisor 2024.7.0+ is thus needed for this
test to pass.

* Bump requirements for tests
2024-08-06 11:02:59 +02:00
Jan Čermák
6c7b6fdebe
Generate version information for RAUC when rauc.db is empty (#3436)
RAUC currently doesn't know the version of the booted slot when booted for the
first time or after wiping the data partition. As a result `ha os info` is
missing this information too.

As there's no built-in mechanism for generating these data by RAUC itself, add
a oneshot service that checks if the boot slot information is contained in the
rauc.db and if not, then generate it.

RAUC seems to cope quite well even with bogus data contained in rauc.db but in
any case, a test has been added to check that everything works as expected.
2024-06-20 16:50:14 +02:00
Jan Čermák
87a6c84025
Fix boot slot A marked as bad on the very first boot (#3435)
On the very first boot, grubenv doesn't exist and loading and saving it
silently fails. However, it is later created by the hassos-persists script and
the missing information are added by grub.cfg on the next boot. As the
consequence, when RAUC tries to get information from grubenv on the first boot,
ORDER variable is missing and the slot is reported as bad.

Fixes #3376
2024-06-20 12:57:25 +02:00
Jan Čermák
2888ccf28e
Improve handling of timeouts in tests (#2890)
* Improve handling of timeouts in tests

Make timeout handling in tests more transparent. Added a custom shell
driver that allows to define global timeout for commands in the config
file, and replaced for/sleep constructs with infinite loops that will be
eventually terminated by pytest-timeout plugin. Current timeouts taken
from last runs on Github CI with some extra headroom.

* test_supervisor_is_updated shouldn't be skipped if no update was needed

* Allow more time for system startup

* Allow even more time for system startup
2023-10-31 18:16:49 +01:00
Jan Čermák
39778e882a
Add test suite for Supervisor tests (#2880)
* Add test suite for Supervisor tests

* test_supervisor_is_updated should depend on test_update_supervisor

Co-authored-by: Stefan Agner <stefan@agner.ch>

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
2023-10-31 10:12:10 +01:00
Jan Čermák
3e36628c09
Create foundation for Labgrid-based OS tests (#2812)
* Create foundation for Labgrid-based OS tests

Add foundation for Labgrid-based tests of OS builds. Currently uses just
the QEMU driver, which starts a virtual machine with pristine OS, and
generates few log reports which are saved as build artifacts.

Workflow is currently triggered either manually by specifying an OS
version, or by OS build job, which now saves an artifact of the OVA
image. This allows for some modularity. If we eventually add the
possibility to run builds on PRs, we could also add the workflow_call
trigger and turn the workflow into a reusable one.

TBD (in future PRs): some meaningful tests and possibility to test on
real hardware (either local or distributed).

* Apply suggestions from @agners

Co-authored-by: Stefan Agner <stefan@agner.ch>

* Wrap test command in a script, create venv for local tests

* Make shellcheck happy

---------

Co-authored-by: Stefan Agner <stefan@agner.ch>
2023-10-17 18:23:29 +02:00