mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-11-04 01:19:32 +01:00 
			
		
		
		
	Update Molecule file conventions to v3.
This commit is contained in:
		
							parent
							
								
									615f261a3d
								
							
						
					
					
						commit
						0bcece6447
					
				@ -7,7 +7,6 @@ lint: |
 | 
			
		||||
  set -e
 | 
			
		||||
  yamllint .
 | 
			
		||||
  ansible-lint
 | 
			
		||||
  # flake8
 | 
			
		||||
platforms:
 | 
			
		||||
  - name: centos-7
 | 
			
		||||
    image: centos:7
 | 
			
		||||
@ -28,4 +27,4 @@ platforms:
 | 
			
		||||
provisioner:
 | 
			
		||||
  name: ansible
 | 
			
		||||
verifier:
 | 
			
		||||
  name: testinfra
 | 
			
		||||
  name: ansible
 | 
			
		||||
 | 
			
		||||
@ -1,33 +0,0 @@
 | 
			
		||||
"""
 | 
			
		||||
Validate host properties using Pytest after Ansible is finished. Uses Testinfra
 | 
			
		||||
 | 
			
		||||
Possible tests:
 | 
			
		||||
- https://testinfra.readthedocs.io/en/latest/modules.html#host
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
# import pytest
 | 
			
		||||
import testinfra.utils.ansible_runner
 | 
			
		||||
 | 
			
		||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 | 
			
		||||
    os.environ['MOLECULE_INVENTORY_FILE']
 | 
			
		||||
).get_hosts('all')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_borgmatic_config(host):
 | 
			
		||||
    f = host.file('/etc/borgmatic/config.yaml')
 | 
			
		||||
 | 
			
		||||
    assert f.exists
 | 
			
		||||
    assert f.user == 'root'
 | 
			
		||||
    assert f.group == 'root'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# @pytest.mark.parametrize('file, content', [
 | 
			
		||||
#   ("/etc/firewalld/zones/public.xml", "<service name=\"http\"/>"),
 | 
			
		||||
#   ("/var/www/html/index.html", "Managed by Ansible")
 | 
			
		||||
# ])
 | 
			
		||||
# def test_files(host, file, content):
 | 
			
		||||
#     file = host.file(file)
 | 
			
		||||
 | 
			
		||||
#     assert file.exists
 | 
			
		||||
#     assert file.contains(content)
 | 
			
		||||
							
								
								
									
										7
									
								
								molecule/default/verify.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								molecule/default/verify.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Verify
 | 
			
		||||
  hosts: all
 | 
			
		||||
  tasks:
 | 
			
		||||
  - name: Example assertion
 | 
			
		||||
    assert:
 | 
			
		||||
      that: true
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user