Skip to content

feat: add job consumer service functionality #263

feat: add job consumer service functionality

feat: add job consumer service functionality #263

name: Webhook Gateway Integration Tests
on:
pull_request:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
webhook-gateway: ${{ steps.filter.outputs.webhook-gateway }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
webhook-gateway:
- 'cmd/webhook-gateway/**'
- 'webhook-gateway-operator/**'
- 'internal/**'
- '.github/workflows/webhook_gateway_tests.yaml'
integration-test:
needs: detect-changes
if: needs.detect-changes.outputs.webhook-gateway == 'true'
runs-on: [self-hosted-linux-amd64-noble-edge]
name: Run Integration Tests
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.25
- name: Wait for rabbitmq
run: |
until curl -fs http://localhost:15672;
do echo "waiting for rabbit mq"
sleep 2
done
- name: Build and Test
env:
RABBITMQ_CONNECT_STRING: amqp://guest:guest@localhost:5672/
APP_PORT: 8080
APP_WEBHOOK_SECRET_VALUE: fake-secret
run: |
go test -v -cover -tags=integration -race ./cmd/webhook-gateway/...
services:
rabbitmq:
image: rabbitmq:4-management
ports:
- 5672:5672
- 15672:15672
charm-integration-tests:
needs: detect-changes
if: needs.detect-changes.outputs.webhook-gateway == 'true'
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
secrets: inherit
permissions:
packages: write
with:
self-hosted-runner: true
self-hosted-runner-label: "edge"
juju-channel: 3.6/stable
provider: microk8s
microk8s-addons: "dns ingress rbac storage registry"
channel: 1.34-strict
rockcraft-channel: latest/edge
charmcraft-channel: latest/edge
test-tox-env: webhook-gateway-integration
webhook-gateway-integration-status-check:
runs-on: ubuntu-latest
needs: [detect-changes, integration-test, charm-integration-tests]
if: always()
steps:
- name: Check integration test results
run: |
# If tests were skipped because no changes, that's success
if [ "${{ needs.detect-changes.outputs.webhook-gateway }}" != "true" ]; then
echo "No webhook-gateway changes detected, skipping tests is expected"
exit 0
fi
# If tests ran, check their results
integration_result="${{ needs.integration-test.result }}"
charm_result="${{ needs.charm-integration-tests.result }}"
echo "Integration test result: $integration_result"
echo "Charm integration test result: $charm_result"
# Fail if any test that ran actually failed (not skipped)
if [ "$integration_result" = "failure" ] || [ "$charm_result" = "failure" ]; then
echo "One or more integration tests failed"
exit 1
fi
echo "All integration tests passed or were skipped appropriately"
exit 0