Skip to content

Commit 691d324

Browse files
committed
Replaced previous Molecule testing with new
1 parent f06a195 commit 691d324

File tree

11 files changed

+87
-127
lines changed

11 files changed

+87
-127
lines changed

molecule/default/Dockerfile.j2

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ FROM {{ item.registry.url }}/{{ item.image }}
66
FROM {{ item.image }}
77
{% endif %}
88

9-
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
10-
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
11-
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
12-
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
9+
{% if item.env is defined %}
10+
{% for var, value in item.env.items() %}
11+
{% if value %}
12+
ENV {{ var }} {{ value }}
13+
{% endif %}
14+
{% endfor %}
15+
{% endif %}
16+
17+
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
18+
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
19+
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
20+
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
1321
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
14-
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
22+
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi

molecule/default/molecule.yml

Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,89 @@ driver:
55
name: docker
66
lint:
77
name: yamllint
8-
options:
9-
config-data:
10-
ignore: molecule
118
platforms:
12-
- name: centos6
13-
image: centos:6
149
- name: centos7
15-
image: centos:7
16-
command: /sbin/init
10+
image: jrei/systemd-centos:7
11+
privileged: true
12+
command: /usr/sbin/init
1713
tmpfs:
1814
- /run
1915
- /tmp
2016
volumes:
2117
- /sys/fs/cgroup:/sys/fs/cgroup:ro
22-
# - name: debian8
23-
# image: debian:8
24-
- name: debian9
25-
image: debian:9
26-
- name: debian10
27-
image: debian:10
28-
# - name: fedora28
29-
# image: fedora:28
30-
# command: /sbin/init
18+
# - name: centos8
19+
# image: jrei/systemd-centos:8
20+
# privileged: true
21+
# command: /usr/sbin/init
3122
# tmpfs:
3223
# - /run
3324
# - /tmp
3425
# volumes:
3526
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
36-
# - name: fedora29
37-
# image: fedora:29
38-
# command: /sbin/init
39-
# tmpfs:
40-
# - /run
41-
# - /tmp
42-
# volumes:
43-
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
44-
# - name: fedora30
45-
# image: fedora:30
46-
# command: /sbin/init
27+
# - name: debian8
28+
# image: jrei/systemd-debian:8
29+
# privileged: true
30+
# command: /lib/systemd/systemd
4731
# tmpfs:
4832
# - /run
4933
# - /tmp
5034
# volumes:
5135
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
52-
# - name: ubuntu1404
53-
# image: ubuntu:14.04
54-
- name: ubuntu1604
55-
image: ubuntu:16.04
36+
- name: debian9
37+
image: jrei/systemd-debian:9
38+
privileged: true
39+
command: /lib/systemd/systemd
40+
tmpfs:
41+
- /run
42+
- /tmp
43+
volumes:
44+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
45+
- name: debian10
46+
image: jrei/systemd-debian:10
47+
privileged: true
5648
command: /lib/systemd/systemd
57-
capabilities:
58-
- SYS_ADMIN
49+
tmpfs:
50+
- /run
51+
- /tmp
5952
volumes:
6053
- /sys/fs/cgroup:/sys/fs/cgroup:ro
54+
- name: fedora
55+
image: jrei/systemd-fedora
56+
privileged: true
57+
command: /usr/sbin/init
58+
tmpfs:
59+
- /run
60+
- /tmp
61+
volumes:
62+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
63+
- name: ubuntu1604
64+
image: jrei/systemd-ubuntu:16.04
65+
privileged: true
66+
command: /lib/systemd/systemd
6167
tmpfs:
6268
- /run
6369
- /tmp
70+
volumes:
71+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
6472
- name: ubuntu1804
65-
image: ubuntu:18.04
66-
- name: ubuntu1904
67-
image: ubuntu:19.04
73+
image: jrei/systemd-ubuntu:18.04
74+
privileged: true
75+
command: /lib/systemd/systemd
76+
tmpfs:
77+
- /run
78+
- /tmp
79+
volumes:
80+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
6881
provisioner:
6982
name: ansible
7083
lint:
7184
name: ansible-lint
72-
options:
73-
x: ["301", "401"]
74-
inventory:
75-
host_vars:
76-
fedora30:
77-
ansible_python_interpreter: /usr/bin/python3
78-
centos6:
79-
netdata_centos6_install_okay: true
85+
playbooks:
86+
converge: ../shared/playbook.yml
8087
verifier:
8188
name: testinfra
89+
directory: ../shared/tests
8290
lint:
8391
name: flake8
92+
additional_files_or_dirs:
93+
- ../shared/*

molecule/default/playbook.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

molecule/shared/playbook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
roles:
5+
- role: ansible-netdata

molecule/default/tests/test_default.py renamed to molecule/shared/tests/test_default.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import testinfra.utils.ansible_runner
44

55
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
6-
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
6+
os.environ['MOLECULE_INVENTORY_FILE']
7+
).get_hosts('all')
78

89

910
def test_hosts_file(host):

molecule/vagrant/molecule.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,27 @@ driver:
88
lint:
99
name: yamllint
1010
platforms:
11-
# - name: centos6
12-
# box: mrlesmithjr/centos6
13-
# memory: 1024
14-
# cpus: 1
15-
# - name: centos7
16-
# box: mrlesmithjr/centos7
17-
# memory: 1024
18-
# cpus: 1
11+
- name: centos7
12+
box: mrlesmithjr/centos7
13+
- name: centos8
14+
box: mrlesmithjr/centos8
1915
- name: debian9
2016
box: mrlesmithjr/stretch64
21-
memory: 1024
22-
cpus: 1
2317
- name: debian10
2418
box: mrlesmithjr/buster64
25-
memory: 1024
26-
cpus: 1
27-
# - name: ubuntu1604
28-
# box: mrlesmithjr/xenial64
29-
# memory: 1024
30-
# cpus: 1
31-
# - name: ubuntu1804
32-
# box: mrlesmithjr/bionic64
33-
# memory: 1024
34-
# cpus: 1
35-
# - name: ubuntu1904
36-
# box: mrlesmithjr/dingo64
37-
# memory: 1024
38-
# cpus: 1
19+
- name: ubuntu1604
20+
box: mrlesmithjr/xenial64
21+
- name: ubuntu1804
22+
box: mrlesmithjr/bionic64
3923
provisioner:
4024
name: ansible
4125
lint:
4226
name: ansible-lint
43-
options:
44-
x: ["301", "401"]
27+
playbooks:
28+
converge: ../shared/playbook.yml
4529
verifier:
4630
name: testinfra
4731
lint:
4832
name: flake8
33+
additional_files_or_dirs:
34+
- ../shared/*

molecule/vagrant/playbook.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

molecule/vagrant/prepare.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
gather_facts: false
55
tasks:
66
- name: Install python for Ansible
7-
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
7+
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) || (sudo yum -y install python3 && sudo alternatives --set python /usr/bin/python3)
88
become: true
99
changed_when: false

molecule/vagrant/tests/test_default.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/inventory

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)