Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature/tests #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

adam-trhon
Copy link
Contributor

No description provided.

With old systemd (before 240), just after boot, the
get_systemd_status_raw function fails with the following exception:

ValueError: invalid literal for int() with base 10: '2 "star'

Calling `print(path_and_id)` before parsing prints the following:

    /org/freedesktop/systemd1/unit/syslog_2eservice" 0 "
    /org/freedesktop/systemd1/unit/alsa_2drestore_2eservice" 0 "
    /org/freedesktop/systemd1/unit/dev_2dram0_2edevice" 0 "
    /org/freedesktop/systemd1/unit/multi_2duser_2etarget" 2 "start

The last line causes the error which is fixed by this patch.

Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
Setup test infrastructure, populate it with a simple test of
get_systemd_version function.

Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
The newly added test of get_systemd_status failed for old systemd with

	>       assert status['systemd-resolved.service']["type"] == ''
	E       assert '"' == ''
	E         + "

	tests/test_linux.py:36: AssertionError

so refactor parsing of path_and_id to fix that.

Signed-off-by: Adam Trhon <adam.trhon@tbs-biometrics.com>
@adam-trhon
Copy link
Contributor Author

adam-trhon commented Nov 16, 2021

I modified the first patch to also include coverage

@Emantor Emantor self-assigned this Dec 1, 2021
@adam-trhon
Copy link
Contributor Author

Hello, any progress here?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants