Skip to content

Commit cb3558b

Browse files
committed
Test using initctl faker.
1 parent e0424d2 commit cb3558b

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

.travis.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ env:
66
# https://github.com/travis-ci/travis-ci/issues/6461#issuecomment-239577306
77
DOCKER_VERSION: "1.9.1-0~trusty"
88
matrix:
9-
- distro: centos6
10-
init: /sbin/init
11-
run_opts: ""
12-
playbook: test.yml
139
- distro: centos7
1410
init: /usr/lib/systemd/systemd
1511
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
1612
playbook: centos-7-test.yml
13+
- distro: centos6
14+
init: /sbin/init
15+
run_opts: ""
16+
playbook: test.yml
1717
- distro: ubuntu1604
1818
init: /lib/systemd/systemd
1919
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
@@ -22,11 +22,10 @@ env:
2222
init: /sbin/init
2323
run_opts: ""
2424
playbook: test.yml
25-
# - distro: ubuntu1204
26-
# version: latest
27-
# init: /sbin/init
28-
# run_opts: ""
29-
# playbook: test.yml
25+
- distro: ubuntu1204
26+
init: /sbin/init
27+
run_opts: ""
28+
playbook: test.yml
3029

3130
services:
3231
- docker

tests/initctl_faker

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
ALIAS_CMD="$(echo ""$0"" | sed -e 's?/sbin/??')"
3+
4+
case "$ALIAS_CMD" in
5+
start|stop|restart|reload|status)
6+
exec service $1 $ALIAS_CMD
7+
;;
8+
esac
9+
10+
case "$1" in
11+
list )
12+
exec service --status-all
13+
;;
14+
reload-configuration )
15+
exec service $2 restart
16+
;;
17+
start|stop|restart|reload|status)
18+
exec service $2 $1
19+
;;
20+
\?)
21+
exit 0
22+
;;
23+
esac

tests/test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
---
22
- hosts: all
3+
4+
pre_tasks:
5+
# Override initctl on Ubuntu 14.04.
6+
- block:
7+
- name: Remove existing initctl.
8+
file: path=/sbin/initctl state=absent
9+
- name: Copy initctl_faker into place for Ubuntu 14.04.
10+
copy:
11+
src: initctl_faker
12+
dest: /sbin/initctl
13+
mode: 0755
14+
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
15+
316
roles:
417
- role_under_test

0 commit comments

Comments
 (0)