-
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.
Merge branch 'main' into feature/icingaweb-module-graphite
- Loading branch information
Showing
83 changed files
with
2,962 additions
and
71 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
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
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,66 @@ | ||
--- | ||
# These Jobs should be always be run against the latest version of ansible on the systems | ||
# Feel free to update python and ansible versions | ||
# | ||
# In addition to keep them quick and no additional variables are used. | ||
# | ||
name: role-icingadb_redis | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
paths: | ||
- roles/icingadb_redis/** | ||
- molecule/role-icingadb_redis/** | ||
pull_request: | ||
branches: | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
|
||
jobs: | ||
icingadb_redis-ubuntu2204-latest: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
COLLECTION_NAMESPACE: icinga | ||
COLLECTION_NAME: icinga | ||
|
||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 | ||
matrix: | ||
distro: [ubuntu2204] | ||
python: ['3.10'] | ||
ansible: ['2.16.2'] | ||
scenario: [role-icingadb_redis] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install dependencies ansible | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r requirements-test-${{ matrix.ansible }}.txt | ||
- name: Install collection | ||
run: | | ||
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE | ||
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME | ||
- name: Test with molecule | ||
run: | | ||
ansible --version | ||
molecule --version | ||
molecule test -s ${{ matrix.scenario }} | ||
env: | ||
MOLECULE_DISTRO: ${{ matrix.distro }} |
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,66 @@ | ||
--- | ||
# These Jobs should be always be run against the latest version of ansible on the systems | ||
# Feel free to update python and ansible versions | ||
# | ||
# In addition to keep them quick and no additional variables are used. | ||
# | ||
name: role-icingaweb2 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
paths: | ||
- roles/icingaweb2/** | ||
- molecule/role-icingaweb2/** | ||
pull_request: | ||
branches: | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
|
||
jobs: | ||
icingaweb2-ubuntu2204-latest: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
COLLECTION_NAMESPACE: icinga | ||
COLLECTION_NAME: icinga | ||
|
||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 | ||
matrix: | ||
distro: [ubuntu2204] | ||
python: ['3.10'] | ||
ansible: ['2.16.2'] | ||
scenario: [role-icingaweb2] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install dependencies ansible | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r requirements-test-${{ matrix.ansible }}.txt | ||
- name: Install collection | ||
run: | | ||
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE | ||
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME | ||
- name: Test with molecule | ||
run: | | ||
ansible --version | ||
molecule --version | ||
molecule test -s ${{ matrix.scenario }} | ||
env: | ||
MOLECULE_DISTRO: ${{ matrix.distro }} |
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,62 @@ | ||
name: Icingaweb2 Templates | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- main | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
paths: | ||
- 'roles/icingaweb2/templates/**' | ||
- 'molecule/ini-configuration-tests/**' | ||
pull_request: | ||
branches: | ||
- 'feature/**' | ||
- 'fix/**' | ||
- '!doc/**' | ||
|
||
jobs: | ||
test_ini_template: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
COLLECTION_NAMESPACE: icinga | ||
COLLECTION_NAME: icinga | ||
|
||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 | ||
matrix: | ||
distro: [ubuntu2204] | ||
python: ['3.9', '3.10'] | ||
ansible: ['2.13.10', '2.14.7'] | ||
scenario: [ini-configuration-tests] | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install dependencies ansible | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r requirements-test-${{ matrix.ansible }}.txt | ||
- name: Install collection | ||
run: | | ||
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE | ||
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME | ||
- name: Test with molecule | ||
run: | | ||
ansible --version | ||
molecule --version | ||
molecule test -s ${{ matrix.scenario }} | ||
env: | ||
MOLECULE_DISTRO: ${{ matrix.distro }} |
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
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
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,63 @@ | ||
## Collection Testing Guide | ||
|
||
This guide will quickstart you on our testing environment and eases the way to | ||
contribute on our project. | ||
|
||
### Tests | ||
|
||
Currently we do some molecule tests to check if the roles work in combination | ||
and some variables to check if anything fails. | ||
|
||
Then there are unit tests for the parser which generates the Icinga 2 DSL. | ||
|
||
At last we implemented a way to check if our Icingaweb roles generates valid | ||
ini files. | ||
|
||
### Tools | ||
|
||
Make sure the following tools are available before start testing with the collection. | ||
|
||
``` | ||
pip install ansible-core ansible-lint molecule pytest-testinfra | ||
``` | ||
|
||
To test roles locally without docker/service issues, we created a molecule test | ||
with vagrant. Then you need to install [vagrant](link/to/vagrant) and the molecule plugin. | ||
|
||
`pip install molecule-plugins[vagrant]` | ||
|
||
To use molecule with docker install the docker plugin. | ||
|
||
`pip install molecule-plugins[docker]` | ||
|
||
### Roles Testing | ||
|
||
To test roles over vagrant locally, it is the easiest to run the **local-default** | ||
scenario. The local-default is very big and long running. For shorter tests use | ||
the role-<rolename> scenarios. | ||
|
||
`molecule test -s local-default` | ||
|
||
The following tests are inplemented based on docker. Per default a **ubuntu2204** | ||
image from geerlingguy's container is used. Thanks [@geerlingguy Dockerhublink](https://hub.docker.com/u/geerlingguy) | ||
|
||
To test other distros use the command with the env **MOLECULE_DISTRO**. | ||
|
||
`MOLECULE_DISTRO=opensuseleap15 molecule test -s role-icingadb_redis` | ||
|
||
### Templating Tests | ||
|
||
The roles are generating configuration for Icingaweb2 and Icinga2 in various files. | ||
To ensure values are written to these files in right syntax we test those too. | ||
|
||
#### Python Unittest | ||
|
||
For testing our Icinga 2 objects syntax we implemented python unittests and try | ||
many combinations which occur in different python versions. | ||
|
||
For more information please have a look at the workflow `Python Unittest`. | ||
|
||
#### Icingaweb2 INI | ||
|
||
To test the INI configuration over Ansible in the Icinga Web 2 role, we implemented | ||
a molecule test to include the template from the role and test it with various values. |
Oops, something went wrong.