molecule testing added
This commit is contained in:
parent
1004727dae
commit
0afc95bb5f
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.yamllint
|
17
molecule/default/INSTALL.rst
Normal file
17
molecule/default/INSTALL.rst
Normal 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
|
22
molecule/default/molecule.yml
Normal file
22
molecule/default/molecule.yml
Normal 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
|
6
molecule/default/playbook.yml
Normal file
6
molecule/default/playbook.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- role: ansible-cockpit
|
9
molecule/default/prepare.yml
Normal file
9
molecule/default/prepare.yml
Normal 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
|
Binary file not shown.
Binary file not shown.
BIN
molecule/default/tests/__pycache__/test_default.cpython-37.pyc
Normal file
BIN
molecule/default/tests/__pycache__/test_default.cpython-37.pyc
Normal file
Binary file not shown.
25
molecule/default/tests/test_default.py
Normal file
25
molecule/default/tests/test_default.py
Normal 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
|
17
molecule/non_defaults/INSTALL.rst
Normal file
17
molecule/non_defaults/INSTALL.rst
Normal 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
|
22
molecule/non_defaults/molecule.yml
Normal file
22
molecule/non_defaults/molecule.yml
Normal 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
|
9
molecule/non_defaults/playbook.yml
Normal file
9
molecule/non_defaults/playbook.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
cockpit_listen_port: 9091
|
||||||
|
cockpit_use_selinux: true
|
||||||
|
roles:
|
||||||
|
- role: ansible-cockpit
|
9
molecule/non_defaults/prepare.yml
Normal file
9
molecule/non_defaults/prepare.yml
Normal 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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
25
molecule/non_defaults/tests/test_non_defaults.py
Normal file
25
molecule/non_defaults/tests/test_non_defaults.py
Normal 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
|
Loading…
Reference in New Issue
Block a user