Skip to content
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

PoC: Add hosted integration testing #714

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove "partner" from code.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove "partner"

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
Loading