This guide helps you set up foremanctl development enviornment.
- Vagrant - 2.2+
- Ansible - 2.14+
- Vagrant Libvirt provider plugin
- Virtualization enabled in BIOS
Follow instructions to install Vagrant and Libvirt.
To setup the environment, run the setup script which will create a virtualenv and populate all of the dependencies:
./setup-environment
source .venv/bin/activate
This setup uses Vagrant to create a basic VM for running the deployment on:
./setup-environment
source .venv/bin/activate
./forge vms start
./foremanctl deploy --initial-admin-password=changeme --tuning development --initial-organization "Foreman CI" --initial-location "Internet"
./forge setup-repositories
./foremanctl deploy --add-feature hammer
To teardown the environment:
./forge vms stop
Ensure you have a deployment. Now run the tests:
./forge test
Note
This will trigger all the tests so hammer tests will fail if you don't have hammer setup
You can also directly run specific tests:
pytest tests/postgresql_test.py
pytest tests/foreman_test.py::test_foreman_service
Additonally, you can run smoker based tests with:
./forge smoker
Configuration files for services are stored as podman secrets and mounted into the container at the expected locations. These configuration files can be listed:
podman secret ls
To view an individual configuration file:
podman secret inspect --showsecret --format "{{.SecretData}}" <secret-name>
Each secret, whether a configuration file or value shall following the following conventions:
Naming:
* Config files: <role_namespace>-<filename>-<extension>
* Strings: <role_namespace>-<descriptive_name>
Naming when additional application context is required that does not match the role_namespace:
* Config files: <role_namespace>-<app>-<filename>-<extension>
* Strings: <role_namespace>-<app>-<descriptive_name>
Each shall contain labels that provide additional metadata:
* Config Files
- filename: <name of file>.<extension>
- app: <name of application that uses the configuration file>
* Strings:
- app: <name of application that uses the string>