Add unit test to validate PID files exist

This is a follow up to a previous commit, make sure the PID files
actually exist.

We only need this for initd scripts today.

Change-Id: Iedad736a9656aa04bc9b696051e421663061c0bb
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-11-26 11:36:53 -05:00
parent 195cafd40d
commit 01acdd5bad
1 changed files with 68 additions and 0 deletions

View File

@ -273,6 +273,23 @@
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /var/run/nodepool/nodepool.pid
stat:
path: /var/run/nodepool/nodepool.pid
register: _nodepool_service_pid_stat
- name: Assert /var/run/nodepool-builder/nodepool-builder.pid tests
assert:
that:
- _nodepool_service_pid_stat.stat.exists
- _nodepool_service_pid_stat.stat.isreg
- _nodepool_service_pid_stat.stat.pw_name == 'nodepool'
- _nodepool_service_pid_stat.stat.gr_name == 'nodepool'
- _nodepool_service_pid_stat.stat.mode == '0644'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Ensure nodepoold is running.
become: yes
shell: /usr/sbin/service nodepool status
@ -348,6 +365,23 @@
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /var/run/nodepool-builder/nodepool-builder.pid
stat:
path: /var/run/nodepool-builder/nodepool-builder.pid
register: _nodepool_builder_service_pid_stat
- name: Assert /var/run/nodepool-builder/nodepool-builder.pid tests
assert:
that:
- _nodepool_builder_service_pid_stat.stat.exists
- _nodepool_builder_service_pid_stat.stat.isreg
- _nodepool_builder_service_pid_stat.stat.pw_name == 'nodepool'
- _nodepool_builder_service_pid_stat.stat.gr_name == 'nodepool'
- _nodepool_builder_service_pid_stat.stat.mode == '0644'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Ensure nodepool-builder is running.
become: yes
shell: /usr/sbin/service nodepool-builder status
@ -423,6 +457,23 @@
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /var/run/nodepool-deleter/nodepool-deleter.pid
stat:
path: /var/run/nodepool-deleter/nodepool-deleter.pid
register: _nodepool_deleter_service_pid_stat
- name: Assert /var/run/nodepool-deleter/nodepool-deleter.pid tests
assert:
that:
- _nodepool_deleter_service_pid_stat.stat.exists
- _nodepool_deleter_service_pid_stat.stat.isreg
- _nodepool_deleter_service_pid_stat.stat.pw_name == 'nodepool'
- _nodepool_deleter_service_pid_stat.stat.gr_name == 'nodepool'
- _nodepool_deleter_service_pid_stat.stat.mode == '0644'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Ensure nodepool-deleter is running.
become: yes
shell: /usr/sbin/service nodepool-deleter status
@ -498,6 +549,23 @@
when: (ansible_os_family == 'RedHat') or
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial')
- name: Register /var/run/nodepool-launcher/nodepool-launcher.pid
stat:
path: /var/run/nodepool-launcher/nodepool-launcher.pid
register: _nodepool_launcher_service_pid_stat
- name: Assert /var/run/nodepool-launcher/nodepool-launcher.pid tests
assert:
that:
- _nodepool_launcher_service_pid_stat.stat.exists
- _nodepool_launcher_service_pid_stat.stat.isreg
- _nodepool_launcher_service_pid_stat.stat.pw_name == 'nodepool'
- _nodepool_launcher_service_pid_stat.stat.gr_name == 'nodepool'
- _nodepool_launcher_service_pid_stat.stat.mode == '0644'
when:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'trusty'
- name: Ensure nodepool-launcher is running.
become: yes
shell: /usr/sbin/service nodepool-launcher status