Open mcdonnnj opened 7 months ago
The command being run by SystemdService.exists: https://github.com/pytest-dev/pytest-testinfra/blob/54f3b5c933ef597beb4cc96aada5015b64ced933/testinfra/modules/service.py#L179 does not run successfully as it appears to be malformed. When attempting to use it in a molecule test configuration the following error is seen:
SystemdService.exists
E AssertionError: Unexpected exit code 2 for CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f792dec0a70>, exit_status=2, command=b'systemctl list-unit-files | grep -q"^systemd-binfmt"', _stdout=b'', _stderr=b"grep: invalid option -- '^'\nUsage: grep [OPTION]... PATTERNS [FILE]...\nTry 'grep --help' for more information.\n") E assert 2 in [0, 1] E + where 2 = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f792dec0a70>, exit_status=2, command=b'syst...=b"grep: invalid option -- '^'\nUsage: grep [OPTION]... PATTERNS [FILE]...\nTry 'grep --help' for more information.\n").rc
I verified that I receive the same error if I login to a running test container:
root@debian12-systemd:/# systemctl list-unit-files | grep -q"^systemd-binfmt" grep: invalid option -- '^' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. root@debian12-systemd:/# systemctl list-unit-files | grep -q "^systemd-binfmt" root@debian12-systemd:/# echo $? 0
It appears that #754 fixes this issue in addition to adding testing as verified by both the tests in that PR and my own double-check in the same molecule container:
root@debian12-systemd:/# systemctl list-units --all | grep -q "^[[:space:]]*systemd-binfmt" root@debian12-systemd:/# echo $? 0
I hit this same issue and was able to verify that #754 fixes it. Is there any hope of #754 being merged soon?
I believe this issue is resolved by #767, which was released in version 10.1.0.
The command being run by
SystemdService.exists
: https://github.com/pytest-dev/pytest-testinfra/blob/54f3b5c933ef597beb4cc96aada5015b64ced933/testinfra/modules/service.py#L179 does not run successfully as it appears to be malformed. When attempting to use it in a molecule test configuration the following error is seen:I verified that I receive the same error if I login to a running test container:
It appears that #754 fixes this issue in addition to adding testing as verified by both the tests in that PR and my own double-check in the same molecule container: