Skip to content

test: rewrite test suite with ginkgo #652

test: rewrite test suite with ginkgo

test: rewrite test suite with ginkgo #652

name: Lagoon Remote Controller Test
on:
push:
branches:
- main
- re-namespace
pull_request:
branches:
- main
- main-v1beta2
jobs:
test-suite:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
kindest_node_version: [v1.25.16, v1.26.15]
harbor: ["1.9.0","1.14.3"]
lagoon_build_image: ["uselagoon/build-deploy-image:main"]
experimental: [false]
include:
- kindest_node_version: v1.27.13
harbor: "1.14.3"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: false
- kindest_node_version: v1.28.9
harbor: "1.14.3"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: false
- kindest_node_version: v1.29.4
harbor: "1.14.3"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: true
- kindest_node_version: v1.30.2
harbor: "1.14.3"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: true
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 1
continue-on-error: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Set up testing dependencies
run: sudo apt-get update && sudo apt-get -y install build-essential && sudo apt-get clean
- name: Setup correct Go version
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Install kubebuilder
run: |
#kubebuilder
curl -sL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mkdir -p /usr/local/kubebuilder/bin
sudo mv /tmp/kubebuilder_2.3.2_linux_amd64/bin/* /usr/local/kubebuilder/bin
chmod +x /usr/local/kubebuilder/bin/*
echo "/usr/local/kubebuilder/bin" >> $GITHUB_PATH
curl -sL https://github.com/itaysk/kubectl-neat/releases/download/v2.0.3/kubectl-neat_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mkdir -p /usr/local/kubectl-neat/bin
sudo mv /tmp/kubectl-neat /usr/local/kubectl-neat/bin
chmod +x /usr/local/kubectl-neat/bin/*
echo "/usr/local/kubectl-neat/bin" >> $GITHUB_PATH
- name: Check go, kustomize, kubebuilder, helm, kind versions
run: |
go version
kustomize version
helm version
kubebuilder version
kind version
- name: Add dependency chart repos
run: |
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo add harbor https://helm.goharbor.io
helm repo add lagoon https://uselagoon.github.io/lagoon-charts/
helm repo add metallb https://metallb.github.io/metallb
helm repo add jetstack https://charts.jetstack.io
- name: Install gojq
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
run: |
cd /tmp
curl -sSLO https://github.com/itchyny/gojq/releases/download/v0.11.1/gojq_v0.11.1_linux_amd64.tar.gz
tar -xf ./gojq_v0.11.1_linux_amd64.tar.gz
sudo cp /tmp/gojq_v0.11.1_linux_amd64/gojq /usr/local/bin/jq
- name: Configure node IP in kind-config.yaml
run: |
docker network create remote-controller
LAGOON_KIND_CIDR_BLOCK=$(docker network inspect remote-controller | jq '. [0].IPAM.Config[0].Subnet' | tr -d '"')
export KIND_NODE_IP=$(echo ${LAGOON_KIND_CIDR_BLOCK%???} | awk -F'.' '{print $1,$2,$3,240}' OFS='.')
envsubst < test-resources/test-suite.kind-config.yaml.tpl > test-resources/test-suite.kind-config.yaml
- name: Create kind cluster
uses: helm/[email protected]
with:
version: v0.24.0
cluster_name: remote-controller
node_image: kindest/node:${{ matrix.kindest_node_version }}
kubectl_version: v1.30.4
config: test-resources/test-suite.kind-config.yaml
- name: Check node IP matches kind configuration
run: |
LAGOON_KIND_CIDR_BLOCK=$(docker network inspect remote-controller | jq '. [0].IPAM.Config[0].Subnet' | tr -d '"')
NODE_IP=$(echo ${LAGOON_KIND_CIDR_BLOCK%???} | awk -F'.' '{print $1,$2,$3,240}' OFS='.')
echo Checking for NODE_IP "$NODE_IP"
grep $NODE_IP test-resources/test-suite.kind-config.yaml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: uselagoon/remote-controller:test-tag
- name: Run github/test-e2e
run: |
make github/test-e2e HARBOR_VERSION=${{matrix.harbor}} OVERRIDE_BUILD_DEPLOY_DIND_IMAGE="${{matrix.lagoon_build_image}}"