Skip to content

feat: Build integration tests based on OpenStack Rally #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./python/understack-tests/.venv/
2 changes: 1 addition & 1 deletion .github/workflows/code-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id: set-projects
run: |
# grabs all paths with pyproject.toml, snips the 2nd dir, grabs only unique ones, makes a JSON list
projects=$(find python -mindepth 2 -name pyproject.toml | awk -F/ '{print $2}' | sort -u | jq -R -s -c 'split("\n")[:-1]')
projects=$(find python -mindepth 2 ! -wholename 'python/understack-tests/*' -name pyproject.toml | awk -F/ '{print $2}' | sort -u | jq -R -s -c 'split("\n")[:-1]')
echo "projects=$projects" >> "$GITHUB_OUTPUT"
python:
needs: [discover]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
- name: ironic-nautobot-client
- name: nova-flavors
- name: ansible
- name: understack-tests

steps:
- name: setup docker buildx
Expand Down Expand Up @@ -186,6 +187,7 @@ jobs:
- ironic-nautobot-client
- nova-flavors
- ansible
- understack-tests

steps:
- name: clean up PR container
Expand Down
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ repos:
hooks:
- id: ansible-lint
entry: "sh -c 'cd ansible && python3 -m ansiblelint -v --force-color'"
verbose: true
always_run: false
additional_dependencies:
- ansible
- jmespath
files: '^ansible/.*$'
files: '^ansible/.*'
- repo: https://github.com/python-poetry/poetry
rev: '2.1.3'
hooks:
Expand Down
19 changes: 19 additions & 0 deletions containers/understack-tests/Dockerfile.understack-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.12-slim AS builder
ENV UV_PYTHON_DOWNLOADS=never
ENV UV_COMPILE_BYTECODE=1
ENV PATH="/code/.venv/bin:/code/.bin:$PATH"

WORKDIR /code
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
COPY python/understack-tests/uv.lock python/understack-tests/pyproject.toml /code/
RUN --mount=type=cache,target=/root/.cache/uv uv sync --verbose --locked --no-dev
COPY python/understack-tests /code


FROM builder AS prod
WORKDIR /code
COPY --from=builder /code /code
RUN useradd --create-home app
COPY --chown=app:app containers/understack-tests/rally.conf /home/app/.rally/rally.conf
USER app
RUN rally db create
5 changes: 5 additions & 0 deletions containers/understack-tests/rally.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[openstack]
nova_server_boot_timeout = 900

[database]
connection = sqlite:////home/app/.rally/rally.sqlite
6 changes: 6 additions & 0 deletions python/understack-tests/.bin/run-scenario
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
rally db ensure
rally deployment create --fromenv --name=main
rally deployment check
rally task start "$@"
2 changes: 2 additions & 0 deletions python/understack-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.venv
uc_*.json
377 changes: 377 additions & 0 deletions python/understack-tests/README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions python/understack-tests/build_a_single_gp2small_with_network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
title: "Create the network, provision a gp2.small Ubuntu server and delete it afterwards."
subtasks:
- title: "Boot and delete"
workloads:
- scenario:
NovaServers.boot_and_delete_server:
flavor:
name: gp2.small
image:
name: ^Ubuntu 24.*$
config_drive: true
force_delete: false
contexts:
network:
start_cidr: 192.168.91.0/24
dns_nameservers: [8.8.8.8]
11 changes: 11 additions & 0 deletions python/understack-tests/example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
OS_AUTH_URL=https://keystone.dev.undercloud.rackspace.net/v3
OS_USERNAME=your-rally-user
OS_PASSWORD=testpassword
OS_TENANT_NAME=your-rally
OS_PROJECT_NAME=your-rally
OS_REGION_NAME=RegionOne
OS_ENDPOINT_TYPE=publicURL
OS_INTERFACE=public
OS_IDENTITY_API_VERSION=3
OS_USER_DOMAIN_NAME=Default
OS_PROJECT_DOMAIN_NAME=Default
19 changes: 19 additions & 0 deletions python/understack-tests/floating_ips.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
title: Provision gp2.small Ubuntu, test floating IPs
subtasks:
- title: "Boot"
workloads:
- scenario:
NovaServers.boot_server_associate_and_dissociate_floating_ip:
flavor:
name: gp2.small
image:
name: ^Ubuntu 24.*$
floating_network: NET_DEV_69.20.94.128/28
config_drive: true
contexts:
network:
start_cidr: 192.168.91.0/24
dns_nameservers: [8.8.8.8]
router:
external: true
8 changes: 8 additions & 0 deletions python/understack-tests/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[project]
name = "understack-tests"
version = "0.1.0"
description = "Integration tests for Undercloud"
requires-python = ">=3.12"
dependencies = [
"rally-openstack>=3.0.0",
]
25 changes: 25 additions & 0 deletions python/understack-tests/ssh-scenario.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
title: "Provision Ubuntu server, log in, check uptime then destroy."
subtasks:
- title: "Boot and delete"
workloads:
- scenario:
VMTasks.boot_runcommand_delete:
flavor:
name: gp2.small
image:
name: ^Ubuntu 24.*$
config_drive: true
force_delete: false
username: ubuntu
key_name: my-rally-key
command:
script_inline: |
echo "Hello hello!"
hostname
uptime
interpreter: "/bin/sh"
contexts:
network:
start_cidr: 192.168.91.0/24
dns_nameservers: [8.8.8.8]
Loading
Loading