Changeset - 57b1e111d650
[Not reviewed]
0 4 0
Branko Majic (branko) - 6 years ago 2018-05-27 19:41:25
branko@majic.rs
MAR-129: Updated backup_server role tests and fixed some issues:

- Updated how the tests are referencing the relevant hosts to run the
tests on.
- Use "state: present" for package installation.
4 files changed with 9 insertions and 4 deletions:
0 comments (0 inline, 0 general)
roles/backup_server/molecule/default/tests/test_default.py
Show inline comments
 
import os
 

	
 
import testinfra.utils.ansible_runner
 

	
 

	
 
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
    '.molecule/ansible_inventory.yml').get_hosts('all')
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts(['parameters-mandatory', 'parameters-optional'])
 

	
 

	
 
def test_installed_software(host):
roles/backup_server/molecule/default/tests/test_parameters_mandatory.py
Show inline comments
 
import os
 

	
 
import testinfra.utils.ansible_runner
 

	
 

	
 
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
    '.molecule/ansible_inventory.yml').get_hosts('parameters-mandatory')
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts(['parameters-mandatory'])
 

	
 

	
 
def test_firewall_configuration(host):
roles/backup_server/molecule/default/tests/test_parameters_optional.py
Show inline comments
 
@@ -4,7 +4,7 @@ import testinfra.utils.ansible_runner
 

	
 

	
 
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
    '.molecule/ansible_inventory.yml').get_hosts('parameters-optional')
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts(['parameters-optional'])
 

	
 

	
 
def test_backup_client_users_and_groups(host):
roles/backup_server/tasks/main.yml
Show inline comments
 
@@ -3,7 +3,7 @@
 
- name: Install backup software
 
  apt:
 
    name: "{{ item }}"
 
    state: installed
 
    state: present
 
  with_items:
 
    - duplicity
 
    - duply
0 comments (0 inline, 0 general)