/srv/irclogs.ubuntu.com/2024/12/07/#cloud-init.txt

dilfridgequestion00:13
dilfridgein a test in the distros subdir, can I use distros.uses_systemd() ?00:14
dilfridge[working on implementing gentoo+systemd support, but the tested behaviour depends on that property]00:14
holmanbdilfridge: hello00:23
holmanbUm00:23
holmanbHow do you mean? 00:24
holmanbTo change tested behavior at test runtime? 00:24
holmanbdilfridge: I'd suggest a separate distro implementation from the openrc one. Otherwise it's going to be a maze of if/else statements that will be annoying to touch. 00:25
dilfridgewell, to be honest, I have no clue how the testsuite works, so I can't really answer the question00:28
dilfridgeand so far I have exactly two if/else, the rest is very generic00:28
holmanbAhh, okay if you have tox installed, just run `tox -e py3`00:28
holmanbThat will run all of the unit tests00:29
* dilfridge is not a particularly big python fan, sorry :]00:29
holmanbOr `tox -e py3-fast` if you want parallelism00:29
dilfridgeI think the common parts are much larger than the separate parts, especially if at some point more package manager stuff gets implemented00:30
dilfridgemost systemd things just worked out of the box immediately00:30
holmanbAlso want to make sure that the linters pass. `tox -e do_format` will autoformat your code. `tox -e ruff` will lint for errors of various types, and `tox -e mypy` will check for type errors00:31
dilfridgeack, thank you00:31
dilfridgeit's late today, but tomorrow...00:31
holmanbThere are some others, but those typically cover a majority of the tests that should matter00:31
holmanbOr just `tox` to run a bunch of them in serial, but that's a bit slower to iterate over00:32
holmanbWhen developing 00:32
dilfridge[basic things work fine, tested with NoCloud]00:32
holmanbSounds good on the if/else, we can adjust later if needed00:33
holmanbCool :D00:33
=== Juesto is now known as Juest
dilfridgeok this is https://github.com/canonical/cloud-init/pull/5918 now12:35
-ubottu:#cloud-init- Pull 5918 in canonical/cloud-init "feat(gentoo): Add compatibility for Gentoo with systemd" [Open]12:35
dilfridgeI *think* the unittest now only tests the systemd case, not the openrc case... but I wasn't sure how to implement that... one would just have to re-run the same test routines with a dist object that returns "not systemd"12:36
holmanbandrewbogott: you can probably just mock the return value of uses_systemd16:17
holmanbOops wrong ping 16:18
holmanbdilfridge: ^^16:18
dilfridgehmm16:24
dilfridgefixing the linter stuff now16:24
dilfridgethe integration test errors seem somewhat unrelated?16:41
dilfridge>  you can probably just mock the return value of uses_systemd18:39
dilfridgepushed a solution based on this... also useful for future tests18:39

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!