Skip to content

Commit

Permalink
PoC: Add hosted integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 committed Nov 27, 2024
1 parent de3cbb2 commit 3ce876b
Show file tree
Hide file tree
Showing 5 changed files with 673 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/actions/setup-partner-cluster/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: setup-partner-cluster
description: 'Setup a partner cluster for testing.'

inputs:
make-command:
description: 'The make command to run.'
required: true

runs:
using: 'composite'
steps:
- name: Check out `certsuite-sample-workload`
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
repository: redhat-best-practices-for-k8s/certsuite-sample-workload
path: certsuite-sample-workload

- name: Check if /etc/docker/daemon.json exists and if not, create it.
shell: bash
run: |
if [ ! -f /etc/docker/daemon.json ]; then
echo '{}' | sudo tee /etc/docker/daemon.json
fi
- name: Bootstrap cluster and docker
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 90
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make bootstrap-cluster; make bootstrap-docker-ubuntu-local

- name: Mount docker volume to /mnt/sdb
shell: bash
run: |
df -h
lsblk
if [ ! -d /mnt/docker-storage ]; then
sudo mkdir /mnt/docker-storage
fi
sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json
sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json
cat /etc/docker/daemon.json
sudo systemctl restart docker
sudo ls -la /mnt/docker-storage
- name: Run 'make rebuild-cluster'
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 90
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make rebuild-cluster

- name: Run 'make ${{inputs.make-command}}'
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 90
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; python3 -m venv .venv; source .venv/bin/activate; pip install --upgrade pip; pip install jinjanator; cp .venv/bin/jinjanate .venv/bin/j2; make ${{ inputs.make-command }}

- name: Show pods
shell: bash
run: oc get pods -A
31 changes: 31 additions & 0 deletions .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Integration Testing

on:
workflow_dispatch:
pull_request:
branches:
- main

jobs:
integration:
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
SKIP_PRELOAD_IMAGES: true
KUBECONFIG: '/home/runner/.kube/config'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23.2

- name: Setup partner cluster
uses: ./.github/actions/setup-partner-cluster
with:
make-command: 'install-for-qe'

- name: Run integration tests
run: make integration-test
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ install: deps-update
test:
go test ./...

integration-test:
go test -tags=integration ./...

coverage-html:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
Expand Down
Loading

0 comments on commit 3ce876b

Please sign in to comment.