Skip to content

Commit 79269de

Browse files
committed
Update formating and fix tests.
1 parent fc41e73 commit 79269de

File tree

7 files changed

+65
-24
lines changed

7 files changed

+65
-24
lines changed

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,116 +11,144 @@ env:
1111
DIST_VERSION=18_04-builded
1212
MONGODB_VERSION=4.2
1313
MONGODB_PACKAGE=mongodb-org
14+
DOCKER_PRIVILEGED=true
1415
- >
1516
DISTRIBUTION=ubuntu
1617
DIST_VERSION=18_04-builded
1718
MONGODB_VERSION=4.0
1819
MONGODB_PACKAGE=mongodb-org
20+
DOCKER_PRIVILEGED=true
1921
- >
2022
DISTRIBUTION=ubuntu
2123
DIST_VERSION=18_04-builded
2224
MONGODB_VERSION=3.6
2325
MONGODB_PACKAGE=mongodb
26+
DOCKER_PRIVILEGED=true
2427
- >
2528
DISTRIBUTION=ubuntu
2629
DIST_VERSION=16_04-builded
2730
MONGODB_VERSION=4.2
31+
DOCKER_PRIVILEGED=true
2832
- >
2933
DISTRIBUTION=ubuntu
3034
DIST_VERSION=16_04-builded
3135
MONGODB_VERSION=4.0
36+
DOCKER_PRIVILEGED=true
3237
- >
3338
DISTRIBUTION=ubuntu
3439
DIST_VERSION=16_04-builded
3540
MONGODB_VERSION=3.6
41+
DOCKER_PRIVILEGED=true
3642
- >
3743
DISTRIBUTION=ubuntu
3844
DIST_VERSION=16_04-builded
3945
MONGODB_VERSION=3.4
46+
DOCKER_PRIVILEGED=true
4047
- >
4148
DISTRIBUTION=ubuntu-upstart
4249
DIST_VERSION=14.04
4350
MONGODB_VERSION=4.0
51+
DOCKER_PRIVILEGED=true
4452
- >
4553
DISTRIBUTION=ubuntu-upstart
4654
DIST_VERSION=14.04
4755
MONGODB_VERSION=3.6
56+
DOCKER_PRIVILEGED=true
4857
- >
4958
DISTRIBUTION=ubuntu-upstart
5059
DIST_VERSION=14.04
5160
MONGODB_VERSION=3.4
61+
DOCKER_PRIVILEGED=true
5262
- >
5363
DISTRIBUTION=debian
5464
DIST_VERSION=9-builded
5565
MONGODB_VERSION=4.2
66+
DOCKER_PRIVILEGED=true
5667
- >
5768
DISTRIBUTION=debian
5869
DIST_VERSION=9-builded
5970
MONGODB_VERSION=4.0
71+
DOCKER_PRIVILEGED=true
6072
- >
6173
DISTRIBUTION=debian
6274
DIST_VERSION=9-builded
6375
MONGODB_VERSION=3.6
76+
DOCKER_PRIVILEGED=true
6477
- >
6578
DISTRIBUTION=debian
6679
DIST_VERSION=8-builded
6780
MONGODB_VERSION=4.0
81+
DOCKER_PRIVILEGED=true
6882
- >
6983
DISTRIBUTION=debian
7084
DIST_VERSION=8-builded
7185
MONGODB_VERSION=3.6
86+
DOCKER_PRIVILEGED=true
7287
- >
7388
DISTRIBUTION=debian
7489
DIST_VERSION=8-builded
7590
MONGODB_VERSION=3.4
91+
DOCKER_PRIVILEGED=true
7692
- >
7793
DISTRIBUTION=centos
7894
DIST_VERSION=6-builded
7995
MONGODB_VERSION=4.2
96+
DOCKER_PRIVILEGED=true
8097
- >
8198
DISTRIBUTION=centos
8299
DIST_VERSION=6-builded
83100
MONGODB_VERSION=4.0
101+
DOCKER_PRIVILEGED=true
84102
- >
85103
DISTRIBUTION=centos
86104
DIST_VERSION=6-builded
87105
MONGODB_VERSION=3.6
106+
DOCKER_PRIVILEGED=true
88107
- >
89108
DISTRIBUTION=centos
90109
DIST_VERSION=6-builded
91110
MONGODB_VERSION=3.4
111+
DOCKER_PRIVILEGED=true
92112
- >
93113
DISTRIBUTION=centos
94114
DIST_VERSION=7-builded
95115
MONGODB_VERSION=4.2
116+
DOCKER_PRIVILEGED=false
96117
- >
97118
DISTRIBUTION=centos
98119
DIST_VERSION=7-builded
99120
MONGODB_VERSION=4.0
121+
DOCKER_PRIVILEGED=false
100122
- >
101123
DISTRIBUTION=centos
102124
DIST_VERSION=7-builded
103125
MONGODB_VERSION=3.6
126+
DOCKER_PRIVILEGED=false
104127
- >
105128
DISTRIBUTION=centos
106129
DIST_VERSION=7-builded
107130
MONGODB_VERSION=3.4
131+
DOCKER_PRIVILEGED=false
108132
- >
109133
DISTRIBUTION=amazonlinux
110134
DIST_VERSION=2-builded
111135
MONGODB_VERSION=4.2
136+
DOCKER_PRIVILEGED=true
112137
- >
113138
DISTRIBUTION=amazonlinux
114139
DIST_VERSION=2-builded
115140
MONGODB_VERSION=4.0
141+
DOCKER_PRIVILEGED=true
116142
- >
117143
DISTRIBUTION=amazonlinux
118144
DIST_VERSION=2-builded
119145
MONGODB_VERSION=3.6
146+
DOCKER_PRIVILEGED=true
120147
- >
121148
DISTRIBUTION=amazonlinux
122149
DIST_VERSION=2-builded
123150
MONGODB_VERSION=3.4
151+
DOCKER_PRIVILEGED=true
124152
125153
services:
126154
- docker

handlers/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
- name: reload systemd
44
systemd:
55
daemon_reload: yes
6-
when: ansible_service_mgr == "systemd" and mongodb_manage_service | bool
6+
when:
7+
- ansible_service_mgr == "systemd"
8+
- mongodb_manage_service | bool
79

810
- name: mongodb reload
911
service:

tasks/install.debian.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
owner: root
6666
group: root
6767
mode: '0644'
68-
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
68+
when:
69+
- ansible_service_mgr == "systemd"
70+
- mongodb_manage_systemd_unit | bool
6971
notify:
7072
- reload systemd
7173

@@ -74,7 +76,9 @@
7476
src: "/lib/systemd/system/{{mongodb_daemon_name}}.service"
7577
dest: "/etc/systemd/system/multi-user.target.wants/{{mongodb_daemon_name}}.service"
7678
state: link
77-
when: ansible_service_mgr == "systemd" and mongodb_manage_systemd_unit | bool
79+
when:
80+
- ansible_service_mgr == "systemd"
81+
- mongodb_manage_systemd_unit | bool
7882
notify:
7983
- reload systemd
8084

tests/Dockerfile.amazonlinux_2-builded

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ FROM amazonlinux:2
33
# This is needed so that ansible managed to read "ansible_default_ipv4"
44
RUN yum install iproute -y
55

6-
# This step is needed since standard CentOS docker image does not come with init-functions installed by default.
7-
# This package seems to be required for Mongo 3.2 and downwards
8-
RUN yum install initscripts -y
9-
106
# we can has SSH
117
EXPOSE 22
128

9+
# This step is needed since standard CentOS docker image does not come with i
10+
# This package seems to be required for Mongo 3.2 and downwards
11+
RUN yum install initscripts -y
12+
1313
# pepare for takeoff
1414
CMD ["/usr/sbin/init"]

tests/Dockerfile.centos_7-builded

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ RUN yum install iproute -y
66
# This step is needed since standard CentOS docker image does not come with EPEL installed by default
77
RUN yum install epel-release -y
88

9-
# This step is needed since standard CentOS docker image does not come with init-functions installed by default.
10-
# This package seems to be required for Mongo 3.2 and downwards
11-
RUN yum install initscripts -y
12-
139
# we can has SSH
1410
EXPOSE 22
1511

tests/scripts/test.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ set -o errexit
1212

1313
package=${MONGODB_PACKAGE:-mongodb-org}
1414
# Test 1
15-
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}"
16-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION}
15+
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION}"
16+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION}
1717
# Idempotence test
18-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e image_name=${DISTRIBUTION}:${DIST_VERSION} | \
18+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} | \
1919
grep -q 'changed=0.*failed=0' && \
2020
(echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
2121
# Delete all containers
2222
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
2323

2424
# Test 2
25-
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'"
26-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
25+
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'"
26+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
2727
# Idempotence test
28-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled' \
28+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled' \
2929
| grep -q 'changed=0.*failed=0' \
3030
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
3131
# Delete all containers
3232
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
3333

3434
# Test 3
35-
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'"
36-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
35+
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'"
36+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
3737
# Idempotence test
38-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' \
38+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' \
3939
| grep -q 'changed=0.*failed=0' \
4040
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
4141
# Delete all containers
4242
docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
4343

4444
# Test 4
45-
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'"
46-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'
45+
echo "ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'"
46+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled'
4747
# Idempotence test
48-
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled' \
48+
ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e docker_privileged=${DOCKER_PRIVILEGED} -e image_name=${DISTRIBUTION}:${DIST_VERSION} -e mongodb_package=${package} -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs' -e mongodb_security_authorization='enabled' \
4949
| grep -q 'changed=0.*failed=0' \
5050
&& (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)

tests/site.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
image: "{{ image_name }}"
1212
command: "/sbin/init"
1313
state: started
14-
privileged: true
14+
privileged: "{{ docker_privileged }}"
15+
mounts:
16+
- type: bind
17+
source: /sys/fs/cgroup
18+
target: /sys/fs/cgroup
19+
- type: bind
20+
source: /sys/fs/fuse
21+
target: /sys/fs/fuse
22+
- type: tmpfs
23+
target: /run
24+
- type: tmpfs
25+
target: /run/lock
1526
with_items:
1627
- mongo1
1728
- mongo2

0 commit comments

Comments
 (0)