Skip to content

Commit

Permalink
Get the testing back in shape
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlexis committed Jun 16, 2021
1 parent 9bca364 commit 2ec705b
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 23 deletions.
37 changes: 27 additions & 10 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
---
# Based on ansible-lint config
extends: default

rules:

# Disable line-length and truthy values reporting
line-length: disable
truthy: disable

# Max 1 space to separate the elements in brakets
braces:
max-spaces-inside: 1

# Max 1 space in empty brackets
level: error
brackets:
min-spaces-inside-empty: 0
max-spaces-inside-empty: 1
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---

galaxy_info:
namespace: powerdns
role_name: pdns
author: PowerDNS Engineering Team
description: Install and configure the PowerDNS Authoritative DNS Server
company: PowerDNS.COM BV
Expand Down Expand Up @@ -29,5 +31,3 @@ galaxy_info:
- pdns
- powerdns
- auth

dependencies: []
11 changes: 11 additions & 0 deletions molecule/pdns-44/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ platforms:
- name: ubuntu-2004
groups: ["pdns"]
image: ubuntu:20.04
tmpfs:
- /run
- /tmp
dockerfile_tpl: debian-systemd

- name: debian-9
Expand All @@ -38,7 +41,15 @@ platforms:
- name: debian-10
groups: ["pdns"]
image: debian:10
privileged: True
volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
tmpfs:
- /run
- /run/lock
- /tmp
dockerfile_tpl: debian-systemd
environment: { container: docker }

# In order to run the tests we need
# a MySQL container to be up & running
Expand Down
9 changes: 5 additions & 4 deletions molecule/resources/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
register: platforms

- name: Discover local Docker images
docker_image_facts:
docker_image_info:
name: "molecule_pdns/{{ item.item.name }}"
with_items: "{{ platforms.results }}"
register: docker_images

- name: Build an Ansible compatible image
docker_image:
path: "{{ molecule_ephemeral_directory }}"
source: build
name: "molecule_pdns/{{ item.item.image }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
force: "{{ item.item.force | default(True) }}"
build:
path: "{{ molecule_ephemeral_directory }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
with_items: "{{ platforms.results }}"
when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0

Expand Down
5 changes: 3 additions & 2 deletions molecule/resources/vars/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---

molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
role-file: requirements.yml
requirements-file: requirements.yml
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
collections:
- name: community.mysql
10 changes: 7 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
molecule<3.1
docker-py==1.10.6
testinfra<5.4
jinja2==2.11.3
ansible-lint==5.0.7
yamllint==1.26.1
molecule[docker]==3.3.0
molecule[lint]==3.3.0
testinfra
docker==5.0.0
4 changes: 2 additions & 2 deletions tox.ini → tox.ini.bak
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 1.8
envlist = py36-ansible{27,28,29}
envlist = ansible{27,28,29}
skipsdist = true

[travis:env]
Expand All @@ -17,4 +17,4 @@ deps =
ansible28: ansible<2.9
ansible29: ansible<2.10
commands =
{posargs:molecule test --all --destroy always}
{posargs:molecule -vv test --all --destroy always}

0 comments on commit 2ec705b

Please sign in to comment.