Skip to content

Commit 3b8d305

Browse files
committed
update tests to test service removal
1 parent f1efe18 commit 3b8d305

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ printf ${green}"Testing Start Handlers and Service\n"${neutral}
6767
docker exec $container_id ansible-playbook /etc/ansible/roles/role_under_test/tests/$playbook -e 'test_handlers=True test_service=True'
6868
printf ${green}"Handlers and Service test passed\n"${neutra}
6969

70+
printf ${green}"Testing Service Removal\n"${neutral}
71+
docker exec $container_id ansible-playbook /etc/ansible/roles/role_under_test/tests/$playbook -e 'service_test=True'
72+
printf ${green}"Service Removal test passed\n"${neutra}
7073

7174
# Remove the Docker container (if configured).
7275
if [ "$cleanup" = true ]; then

tests/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,22 @@
6565
command: echo stopping celery
6666
notify: stop celery services
6767
when: test_handlers is defined
68+
69+
- hosts: localhost
70+
remote_user: root
71+
roles:
72+
- { role: role_under_test, when: service_test is defined, celery_working_dir: /srv, celery_app: tasks, celery_user: celery, celery_services: []}
73+
tasks:
74+
- name: Fail To start Celery
75+
systemd:
76+
name: celeryd
77+
state: stopped
78+
register: failed_start
79+
failed_when: false
80+
when: service_test is defined
81+
82+
- name: Assert failure
83+
assert:
84+
that:
85+
- "'Could not find the requested service celeryd' in failed_start.msg"
86+
when: service_test is defined

0 commit comments

Comments
 (0)