Skip to content

Commit

Permalink
Add a profile that configures test fixtures
Browse files Browse the repository at this point in the history
This commit enables users to spin up the fixtures container locally.
Besides that, a default environment variable for the fixtures is set
in order to allow running tests without the pulp-smash settings file.

[noissue]
  • Loading branch information
lubosmj committed Feb 6, 2023
1 parent 53d9d8d commit 24ba66b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/container_scripts/configure_pulp_smash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ cat > /opt/settings/pulp_smash/settings.json <<EOF
],
"selinux enabled": false,
"version": "3"
},
"custom": {
"fixtures_origin": "${REMOTE_FIXTURES_ORIGIN}"
}
}
EOF
3 changes: 3 additions & 0 deletions client/oci_env/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def get_config(env_file):
"DJANGO_SUPERUSER_USERNAME": "admin",
"DJANGO_SUPERUSER_PASSWORD": "password",

# Test fixtures
"REMOTE_FIXTURES_ORIGIN": "https://fixtures.pulpproject.org/",

# API URL
"API_PROTOCOL": "http",
"API_HOST": "localhost",
Expand Down
15 changes: 15 additions & 0 deletions profiles/local_fixtures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# local\_fixtures

A profile for running test fixtures locally. It pulls down the pulp/pulp-fixtures image which
can be used for running functional tests without relying on the internet connection. The fixtures
are exposed on the very same port on the host machine.

## Usage

Append `local_fixtures` to the `COMPOSE_PROFILE` variable in your `compose.env`.

## Extra Variables

- `PULP_FIXTURES_URL`
- Description: The URL/origin for the test fixtures endpoint.
- Default: "http://local\_fixtures:8080"
9 changes: 9 additions & 0 deletions profiles/local_fixtures/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.7"

services:
local_fixtures:
image: pulp/pulp-fixtures
environment:
- BASE_URL={PULP_FIXTURES_URL}
ports:
- {PULP_FIXTURES_PORT}:{PULP_FIXTURES_PORT}
2 changes: 2 additions & 0 deletions profiles/local_fixtures/profile_default_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PULP_FIXTURES_PORT=8080
PULP_FIXTURES_URL=http://local_fixtures:8080
1 change: 1 addition & 0 deletions profiles/local_fixtures/pulp_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REMOTE_FIXTURES_ORIGIN={PULP_FIXTURES_URL}

0 comments on commit 24ba66b

Please sign in to comment.