Skip to content
Draft
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
76 changes: 10 additions & 66 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
@@ -1,74 +1,18 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

name: Integration tests

on:
pull_request:
schedule:
- cron: "0 15 * * SAT"
- cron: "0 15 * * SAT"

jobs:
integration-tests:
strategy:
matrix:
charm:
- name: haproxy-operator
working-directory: ./haproxy-operator
modules: |
[
"test_action.py",
"test_actions.py",
"test_charm.py",
"test_config.py",
"test_cos.py",
"test_ha.py",
"test_haproxy_route.py",
"test_http_interface.py",
"test_ingress.py",
"test_ingress_per_unit.py",
"test_haproxy_route_tcp.py",
"test_haproxy_route_grpc.py",
"test_haproxy_route_https_backend.py"
]
- name: haproxy-spoe-auth-operator
working-directory: ./haproxy-spoe-auth-operator
modules: '["test_charm.py"]'
- name: haproxy-ddos-protection-configurator
working-directory: ./haproxy-ddos-protection-configurator
modules: '["test_charm.py"]'
- name: haproxy-route-policy-operator
working-directory: ./haproxy-route-policy-operator
modules: '["test_charm.py", "test_haproxy_route_policy_relation.py"]'
name: Integration tests for ${{ matrix.charm.name }}
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
secrets: inherit
with:
provider: lxd
juju-channel: 3/stable
self-hosted-runner: true
charmcraft-channel: latest/edge
working-directory: ${{ matrix.charm.working-directory }}
modules: ${{ matrix.charm.modules }}
with-uv: true
integration-tests-global:
uses:
canonical/operator-workflows/.github/workflows/integration_test.yaml@main
integration-test:
uses: canonical/charm-ci/.github/workflows/integration-test.yml@main
secrets: inherit
with:
use-canonical-k8s: true
provider: 'k8s'
channel: '1.32-classic/stable'
self-hosted-runner: true
juju-channel: 3/stable
modules: |
[
"test_oauth_spoe.py",
"test_haproxy_ddos.py",
"test_haproxy_route_policy.py"
]
with-uv: true
pre-run-script: ./tests/integration/setup-integration-tests.sh
allure-report:
if: ${{ !cancelled() && github.event_name == 'schedule' }}
needs:
- integration-tests
- integration-tests-global
uses: canonical/operator-workflows/.github/workflows/allure_report.yaml@main
permissions:
contents: read
packages: write
actions: read
33 changes: 33 additions & 0 deletions artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 1
rocks: []
charms:
- name: haproxy-ddos-protection-configurator
charmcraft-yaml: haproxy-ddos-protection-configurator/charmcraft.yaml
resources: {}
platforms:
- arch: amd64
- name: haproxy
charmcraft-yaml: haproxy-operator/charmcraft.yaml
resources: {}
platforms:
- arch: amd64
- name: haproxy-route-policy
charmcraft-yaml: haproxy-route-policy-operator/charmcraft.yaml
resources: {}
platforms:
- arch: amd64
- name: haproxy-spoe-auth
charmcraft-yaml: haproxy-spoe-auth-operator/charmcraft.yaml
resources: {}
platforms:
- arch: amd64
snaps:
- name: haproxy-route-policy
snapcraft-yaml: haproxy-route-policy/snap/snapcraft.yaml
pack-dir: haproxy-route-policy
platforms:
- arch: amd64
- name: haproxy-spoe-auth
snapcraft-yaml: haproxy-spoe-auth-snap/snapcraft.yaml
platforms:
- arch: amd64
19 changes: 19 additions & 0 deletions concierge-ck8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
juju:
channel: 3/stable
model-defaults:
test-mode: "true"
automatically-retry-hooks: "false"

providers:
lxd:
enable: true
bootstrap: false
k8s:
enable: true
bootstrap: false
channel: 1.32-classic/stable
features:
load-balancer:
enabled: true
l2-mode: true
cidrs: 10.43.45.0/24
16 changes: 16 additions & 0 deletions concierge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
juju:
channel: 3/stable
model-defaults:
test-mode: "true"
automatically-retry-hooks: "false"

providers:
lxd:
enable: true
bootstrap: true

host:
snaps:
charmcraft:
channel: latest/stable
classic: true
98 changes: 65 additions & 33 deletions spread.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,67 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

project: haproxy-operator-tests

project: haproxy-operator
path: /home/ubuntu/proj
kill-timeout: 60m
warn-timeout: 1m
backends:
github-ci:
type: adhoc

allocate: |
echo "Allocating ad-hoc $SPREAD_SYSTEM"
if [ -z "${GITHUB_RUN_ID:-}" ]; then
FATAL "this back-end only works inside GitHub CI"
exit 1
fi
echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/99-spread-users
ADDRESS localhost:22
discard: |
echo "Discarding ad-hoc $SPREAD_SYSTEM"
integration-test:
type: integration-test
systems:
# username and password are required because docs-spread.yaml creates a new user (ubuntu:ubuntu)
# Before tests are ran.
- ubuntu-24.04:
username: ubuntu
password: ubuntu
workers: 1

suites:
tests/spread/:
summary: Automated spread testing
systems:
- ubuntu-24.04

path: /home/spread/proj
kill-timeout: 1h
- ubuntu-24.04
environment:
CONCIERGE: '$(HOST: echo "${CONCIERGE:-concierge.yaml}")'
OPCLI_GIT_REF: '$(HOST: echo "${OPCLI_GIT_REF:-main}")'
exclude:
- .git
- .tox
- .venv
- .*_cache
integration-suites:
haproxy-operator/tests/integration/:
summary: haproxy-operator integration tests
working-dir: haproxy-operator/
backends:
- integration-test
pytest-arguments-template: |
{% set charm = artifacts.charms | selectattr("name", "equalto", "haproxy") | first %}
{% for build in charm.builds | selectattr("arch", "equalto", arch) %}
--charm-file={{ build.path | replace('./', '../', 1) }}
{% endfor %}
haproxy-spoe-auth-operator/tests/integration/:
summary: haproxy-spoe-auth-operator integration tests
working-dir: haproxy-spoe-auth-operator/
backends:
- integration-test
pytest-arguments-template: |
{% set charm = artifacts.charms | selectattr("name", "equalto", "haproxy-spoe-auth") | first %}
{% for build in charm.builds | selectattr("arch", "equalto", arch) %}
--charm-file={{ build.path | replace('./', '../', 1) }}
{% endfor %}
haproxy-ddos-protection-configurator/tests/integration/:
summary: haproxy-ddos-protection-configurator integration tests
working-dir: haproxy-ddos-protection-configurator/
backends:
- integration-test
pytest-arguments-template: |
{% set charm = artifacts.charms | selectattr("name", "equalto", "haproxy-ddos-protection-configurator") | first %}
{% for build in charm.builds | selectattr("arch", "equalto", arch) %}
--charm-file={{ build.path | replace('./', '../', 1) }}
{% endfor %}
haproxy-route-policy-operator/tests/integration/:
summary: haproxy-route-policy-operator integration tests
working-dir: haproxy-route-policy-operator/
backends:
- integration-test
pytest-arguments-template: |
{% set charm = artifacts.charms | selectattr("name", "equalto", "haproxy-route-policy") | first %}
{% for build in charm.builds | selectattr("arch", "equalto", arch) %}
--charm-file={{ build.path | replace('./', '../', 1) }}
{% endfor %}
tests/integration/:
summary: global integration tests (cross-charm, requires LXD + canonical-k8s)
working-dir: ./
backends:
- integration-test
environment:
CONCIERGE: concierge-ck8s.yaml
prepare: |
k8s config | sudo -u ubuntu juju add-k8s ck8s --client
Loading