Skip to content

Commit

Permalink
Merge pull request #13 from badpacketsllc/10-upgrade-tests
Browse files Browse the repository at this point in the history
Update tests to run using Molecule version 3
  • Loading branch information
tmursch authored May 5, 2020
2 parents 51c8f75 + 4924294 commit 8554220
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
autodetect: false

pylint:
run: no
3 changes: 3 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
extends: default

ignore: .tox/

rules:
braces:
max-spaces-inside: 1
Expand Down
9 changes: 6 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ galaxy_info:
author: 'Mathew Woodyard'
company: 'Bad Packets LLC'
license: 'GPLv3'
min_ansible_version: 2.0
min_ansible_version: 2.4
platforms:
- name: Amazon
versions:
- 2018.03
- name: Amazon Linux 2
versions:
- all
- name: EL
versions:
- 7
- name: Fedora
versions:
- 29
- 30
- 31
- 32
- name: Debian
versions:
- stretch
Expand Down
20 changes: 14 additions & 6 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
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; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
{% if item.env is defined %}
{% for var, value in item.env.items() %}
{% if value %}
ENV {{ var }} {{ value }}
{% endif %}
{% endfor %}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python3 sudo bash ca-certificates iproute2 python3-apt aptitude && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install /usr/bin/python3 /usr/bin/python3-config /usr/bin/dnf-3 sudo bash iproute && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y /usr/bin/python /usr/bin/python2-config sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python3 sudo bash iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python3 sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python3 sudo bash ca-certificates iproute2 && xbps-remove -O; fi
File renamed without changes.
12 changes: 4 additions & 8 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
lint: |
yamllint .
ansible-lint
prospector
platforms:
- name: instance
image: "${MOLECULE_DISTRO}"
Expand All @@ -13,11 +15,5 @@ platforms:
privileged: true
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
13 changes: 6 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ deps =
ansible
docker
molecule
sitepackages = true
testinfra
yamllint
ansible-lint
prospector

[testenv:checkqa]
deps = prospector
commands = prospector

[testenv:amazonlinux-latest]
[testenv:amazonlinux-2]
setenv =
MOLECULE_DISTRO=amazonlinux:latest
MOLECULE_DISTRO=amazonlinux:2
commands = molecule test

[testenv:amazonlinux-1]
Expand Down

0 comments on commit 8554220

Please sign in to comment.