mirror of
https://github.com/atosatto/ansible-minio.git
synced 2024-11-21 11:15:18 +01:00
add alternative settings test scenario
This commit is contained in:
parent
1d79df82b7
commit
fc152824d5
50
molecule/alternative/molecule.yml
Normal file
50
molecule/alternative/molecule.yml
Normal 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
|
14
molecule/alternative/playbook.yml
Normal file
14
molecule/alternative/playbook.yml
Normal 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"
|
44
molecule/alternative/tests/test_minio.py
Normal file
44
molecule/alternative/tests/test_minio.py
Normal 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
|
@ -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 %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user