molecule testing added

master
Sebastien Perreault 4 years ago committed by Barry van Someren
parent 1004727dae
commit 0afc95bb5f
  1. 1
      .gitignore
  2. 17
      molecule/default/INSTALL.rst
  3. 22
      molecule/default/molecule.yml
  4. 6
      molecule/default/playbook.yml
  5. 9
      molecule/default/prepare.yml
  6. BIN
      molecule/default/tests/__pycache__/test_default.cpython-37-PYTEST.pyc
  7. BIN
      molecule/default/tests/__pycache__/test_default.cpython-37.opt-1.pyc
  8. BIN
      molecule/default/tests/__pycache__/test_default.cpython-37.pyc
  9. 25
      molecule/default/tests/test_default.py
  10. 17
      molecule/non_defaults/INSTALL.rst
  11. 22
      molecule/non_defaults/molecule.yml
  12. 9
      molecule/non_defaults/playbook.yml
  13. 9
      molecule/non_defaults/prepare.yml
  14. BIN
      molecule/non_defaults/tests/__pycache__/test_default.cpython-37.opt-1.pyc
  15. BIN
      molecule/non_defaults/tests/__pycache__/test_default.cpython-37.pyc
  16. BIN
      molecule/non_defaults/tests/__pycache__/test_non_defaults.cpython-37-PYTEST.pyc
  17. 25
      molecule/non_defaults/tests/test_non_defaults.py

1
.gitignore vendored

@ -0,0 +1 @@
.yamllint

@ -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

@ -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

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

@ -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

@ -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

@ -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

@ -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

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

@ -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

@ -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
Loading…
Cancel
Save