molecule testing added

This commit is contained in:
Sebastien Perreault 2019-02-06 07:39:41 -05:00 committed by Barry van Someren
parent 1004727dae
commit 0afc95bb5f
17 changed files with 162 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.yamllint

View File

@ -0,0 +1,17 @@
*******
Vagrant driver installation guide
*******
Requirements
============
* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop
* python-vagrant
Install
=======
.. code-block:: bash
$ sudo pip install python-vagrant

View File

@ -0,0 +1,22 @@
---
dependency:
name: galaxy
driver:
name: vagrant
provider:
name: libvirt
lint:
name: yamllint
platforms:
- name: instance
box: centos/7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8

View File

@ -0,0 +1,6 @@
---
- name: Converge
hosts: all
become: true
roles:
- role: ansible-cockpit

View File

@ -0,0 +1,9 @@
---
- name: Prepare
hosts: all
gather_facts: false
tasks:
- name: Install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
become: true
changed_when: false

View File

@ -0,0 +1,25 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_package_is_installed(host):
p = host.package('cockpit')
assert p.is_installed
def test_service_enabled(host):
s = host.service('cockpit.socket')
assert s.is_running
assert s.is_enabled
def test_listening(host):
s = host.socket('tcp://0.0.0.0:9090')
assert s.is_listening

View File

@ -0,0 +1,17 @@
*******
Vagrant driver installation guide
*******
Requirements
============
* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop
* python-vagrant
Install
=======
.. code-block:: bash
$ sudo pip install python-vagrant

View File

@ -0,0 +1,22 @@
---
dependency:
name: galaxy
driver:
name: vagrant
provider:
name: virtualbox
lint:
name: yamllint
platforms:
- name: instance
box: centos/7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: non_defaults
verifier:
name: testinfra
lint:
name: flake8

View File

@ -0,0 +1,9 @@
---
- name: Converge
hosts: all
become: true
vars:
cockpit_listen_port: 9091
cockpit_use_selinux: true
roles:
- role: ansible-cockpit

View File

@ -0,0 +1,9 @@
---
- name: Prepare
hosts: all
gather_facts: false
tasks:
- name: Install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
become: true
changed_when: false

View File

@ -0,0 +1,25 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_package_is_installed(host):
p = host.package('cockpit')
assert p.is_installed
def test_service_enabled(host):
s = host.service('cockpit.socket')
assert s.is_running
assert s.is_enabled
def test_listening(host):
s = host.socket('tcp://0.0.0.0:9091')
assert s.is_listening