-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdf0d86
commit bbc5db0
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
collections: | ||
- name: community.docker | ||
- name: community.general | ||
version: ">=2,<3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
|
||
- name: Converge | ||
hosts: all | ||
vars: | ||
test_cases: | ||
- name: string | ||
_i2_config_hash: | ||
section: | ||
test: string | ||
- name: number | ||
_i2_config_hash: | ||
section: | ||
test: 10 | ||
- name: advanced_filter | ||
_i2_config_hash: | ||
section: | ||
test: '(objectClass=user)' | ||
test2: "!(objectClass=user)" | ||
test3: "!attribute" | ||
- name: list | ||
_i2_config_hash: | ||
section: | ||
test: | ||
- "foo" | ||
- bar | ||
- 'baz' | ||
- name: equal_sign | ||
_i2_config_hash: | ||
section: | ||
test: 'equal=sign' | ||
|
||
|
||
collections: | ||
- icinga.icinga | ||
tasks: | ||
- ansible.builtin.template: | ||
src: "{{ lookup('ansible.builtin.env', 'MOLECULE_PROJECT_DIRECTORY', default=Undefined) }}/roles/icingaweb2/templates/modules_config.ini.j2" | ||
dest: "/tmp/{{ item.name }}" | ||
loop: "{{ test_cases }}" | ||
vars: | ||
_i2_config_hash: "{{ item._i2_config_hash }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: icinga-default | ||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: true | ||
provisioner: | ||
name: ansible | ||
inventory: | ||
link: | ||
host_vars: host_vars/ | ||
verifier: | ||
name: testinfra | ||
directory: tests/integration/ | ||
lint: | | ||
set -e | ||
yamllint --no-warnings roles/ | ||
ansible-lint roles/ |
29 changes: 29 additions & 0 deletions
29
molecule/ini-configuration-tests/tests/integration/test_ini_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def test_string(host): | ||
i2_file = host.file("/tmp/string") | ||
print(i2_file.content_string) | ||
assert i2_file.is_file | ||
assert i2_file.content_string == "\n[section]\ntest = string" | ||
|
||
def test_number(host): | ||
i2_file = host.file("/tmp/number") | ||
print(i2_file.content_string) | ||
assert i2_file.is_file | ||
assert i2_file.content_string == '\n[section]\ntest = "10"' | ||
|
||
def test_list(host): | ||
i2_file = host.file("/tmp/list") | ||
print(i2_file.content_string) | ||
assert i2_file.is_file | ||
assert i2_file.content_string == '\n[section]\ntest = "foo, bar, baz"' | ||
|
||
def test_advanced_filter(host): | ||
i2_file = host.file("/tmp/advanced_filter") | ||
print(i2_file.content_string) | ||
assert i2_file.is_file | ||
assert i2_file.content_string == "\n[section]\ntest = '!(objectClass=user)'\ntest2 = '!(objectClass=user)'\ntest3 = '!attribute'" | ||
|
||
def test_equal_sign(host): | ||
i2_file = host.file("/tmp/equal_sign") | ||
print(i2_file.content_string) | ||
assert i2_file.is_file | ||
assert i2_file.content_string == "\n[section]\ntest = 'equal=sign'" |