Service is_enabled KO
See original GitHub issueHi
I’m testing a salt formula via kitchen, installing and enabling caddy service. As you can see, the service is enabled
kitchen@74cb1d70442b:~$ sudo su
root@74cb1d70442b:/home/kitchen# systemctl status caddy
● caddy.service - Caddy HTTP/2 web server
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-03-19 10:45:59 UTC; 32min ago
Docs: https://caddyserver.com/docs
Main PID: 3042 (caddy)
Tasks: 10 (limit: 4915)
CGroup: /docker/74cb1d70442be3231e88e77c241e11f01e3af60b87eeb25c89df9140535eaa55/system.slice/caddy.service
└─3042 /usr/bin/caddy -log stdout -agree=true -email admin@cozycloud.cc -conf=/etc/caddy/Caddyfile -root=/var/tmp
But testinfra thinks otherwise
============================= test session starts ==============================
platform linux2 -- Python 2.7.13, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /var/lib/jenkins/workspace/salt-formula-caddy/test, inifile: pytest.ini
plugins: testinfra-1.19.0, metadata-1.8.0, html-1.20.0
collected 6 items
test/integration/test_caddy.py ....FF [100%]
=================================== FAILURES ===================================
_ test_service[docker://74cb1d70442be3231e88e77c241e11f01e3af60b87eeb25c89df9140535eaa55] _
host = <testinfra.host.Host object at 0x7ffb77697710>
def test_service(host):
s = host.service("caddy")
assert s.is_running
> assert s.is_enabled
E assert False
E + where False = <service caddy>.is_enabled
Here’s the kitchen verifier command if that might help
verifier:
name: shell
remote_exec: false
command: pytest --junitxml=test/${KITCHEN_INSTANCE}_test_report.xml --html=test/${KITCHEN_INSTANCE}_test_report.html --self-contained-html --color=yes --host="docker://root@${KITCHEN_CONTAINER_ID}" "test/integration/"
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
why isn't my dynamic button disabled with knockoutjs?
1 Answer 1 ; Change your enabled/disabled observable to use a boolean value isEnabled: ko.observable ; Correct the disable data bind syntax in ......
Read more >Check if service is Enabled, Disabled, Running or Stopped
Is it possible to check if a service is either enabled, disabled, running or stopped? I know I can use service $app status...
Read more >WifiManager - Android Developers
Wi-Fi simultaneous connection to multiple internet-providing Wi-FI networks (APs) is enabled and restricted to a single network on different bands (e.g. a ...
Read more >Binding syntax | Commerce Frontend Development
The table below shows examples of how the Knockout bindings map to ... enable, <input data-bind="enable: isEnabled"/> ... APIs and Services.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In case anyone else encounters this issue when exercising testinfra via molecule, I was able to get around it by creating
molecule/default/prepare.yml
with the following content:That’s also an issue I get with a container based on Archlinux. The link
/sbin/init
doesn’t exist and Testinfra falls back to SysVinit.cat
ing/proc/1/comm
seems to give good results (here are some tests I did on vagrant boxes):init
(+rc-service
exists) =>OpenRCService
;init
(+initctl
exists) =>UpstartService
;systemd
=>SystemdService
;systemd
=>SystemdService
;systemd
=>SystemdService
.Also, wouldn’t it be a better idea to fall back to
SystemdService
?I’m volunteering to write a PR if the above sounds OK to you 😃