add alternative settings test scenario

This commit is contained in:
paulfantom 2018-06-25 22:53:37 +02:00
parent 1d79df82b7
commit fc152824d5
No known key found for this signature in database
GPG Key ID: 12AE0185401674E7
4 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,50 @@
---
driver:
name: docker
lint:
name: yamllint
platforms:
- name: minio-centos-7
image: paulfantom/centos-molecule:7
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: minio-fedora-27
image: paulfantom/fedora-molecule:27
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: minio-debian-9
image: paulfantom/debian-molecule:9
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: minio-ubuntu-18.04
image: paulfantom/ubuntu-molecule:18.04
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: minio-ubuntu-16.04
image: paulfantom/ubuntu-molecule:16.04
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
create: ../default/create.yml
prepare: ../default/prepare.yml
converge: playbook.yml
destroy: ../default/destroy.yml
scenario:
name: alternative
verifier:
name: testinfra
lint:
name: flake8
enabled: true

View File

@ -0,0 +1,14 @@
---
- hosts: all
any_errors_fatal: true
roles:
- ansible-minio
vars:
# minio_server_envfile: "/opt/minio"
minio_server_addr: ":80"
minio_server_datadirs:
- "/srv/data1"
- "/srv/data2"
- "/srv/data3"
- "/srv/data4"

View File

@ -0,0 +1,44 @@
import yaml
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
@pytest.fixture()
def AnsibleDefaults(Ansible):
with open("./defaults/main.yml", 'r') as stream:
return yaml.load(stream)
@pytest.mark.parametrize("dirs", [
"/minio-test"
])
def test_directories(host, dirs):
d = host.file(dirs)
assert d.is_directory
assert d.exists
assert d.user == AnsibleDefaults['minio_user']
assert d.group == AnsibleDefaults['minio_group']
assert oct(d.mode) == '0750'
@pytest.mark.parametrize('minio_bin_var', [
'minio_server_bin',
'minio_client_bin',
])
def test_minio_installed(File, AnsibleDefaults, minio_bin_var):
f = File(AnsibleDefaults[minio_bin_var])
assert f.exists
assert f.user == AnsibleDefaults['minio_user']
assert f.group == AnsibleDefaults['minio_group']
assert oct(f.mode) == '0755'
def test_minio_service(Service):
s = Service('minio')
assert s.is_running
assert s.is_enabled

View File

@ -39,7 +39,7 @@ SendSIGKILL=no
SuccessExitStatus=0
{% if minio_server_addr.split(':')[-1] < 1024 %}
{% if (minio_server_addr.split(':')[-1] | int) < 1024 %}
AmbientCapabilities=CAP_NET_BIND_SERVICE
{% endif %}