Skip to content

Latest commit

 

History

History
113 lines (75 loc) · 2.79 KB

File metadata and controls

113 lines (75 loc) · 2.79 KB

Development Guide

This guide helps you set up foremanctl development enviornment.

Table of Contents

Development Environment Setup

Requirements

Follow instructions to install Vagrant and Libvirt.

Development environment

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

Deployment

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"

Deploy hammer (optional)

./forge setup-repositories
./foremanctl deploy --add-feature hammer

To teardown the environment:

./forge vms stop

Testing

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

Service Configuration

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>

Naming Convention

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>