brianbianco/redisio — pull request #142 by martinb3 (2014-08-13 12:45:22+00:00)
Title: Fix init scripts for ubuntu, adjust tests.

So I figured out what is going on with the output from tests and the 'service not found' message RE: https://github.com/brianbianco/redisio/issues/117.

Currently, when you use serverspec and service.be_running, it first tries the init script's status command, like so:

```
"service #{escape(service)} status && service #{escape(service)} status | grep 'running'"
```
(see https://github.com/serverspec/specinfra/blob/master/lib/specinfra/command/ubuntu.rb#L5)

When that fails, it falls back to `ps` and `grep`. Since the tests in this branch had asterisks, they were failing to run any init script, and fell back to the grep which worked. The error message was from `service redis.*6479 status` output. However, when you switch to a test for the exact name `redis6379`, the line above still fails, since it looks for 'running' in the grep output (I guess an ubuntu standard thing).

This commit changes the output of the redis and sentinel init scripts to include the string 'running', which makes serverspec happy and makes it never fall back to the `ps`/`grep`.

HOWEVER, there's another problem it's exposed. The init scripts don't properly report status on Fedora 20, i.e.:
```
[root@default-fedora-20 ~]# systemctl is-active redis6379.service
inactive
[root@default-fedora-20 ~]# ps aux | grep redis | grep -v grep
redis 4108 0.1 0.3 37184 1924 ? Ssl 11:50 0:04 /usr/local/bin/redis-server *:6379
```

So I think this exposes that the sysv init scripts aren't working correctly inside Fedora's systemd wrapper for them. So that's another issue that is making the tests fail. While this commit does make the tests fail, I think it's still worth merging since it's a more accurate test, and exercises the init scripts now too.