Skip to content

Add medusa non regression test #2466

Add medusa non regression test

Add medusa non regression test #2466

# This workflow is for tests that require multiple clusters.
name: Run multi-cluster e2e tests
on:
push:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
pull_request:
branches:
- main
- 'release/**'
paths-ignore:
- 'docs/**'
- 'CHANGELOG/**'
jobs:
build_image:
name: Build Image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.parse_image_tag.outputs.image_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request'
- name: Parse image version
id: parse_image_tag
run: echo "image_tag=$(yq eval '.images[0].newTag' config/deployments/default/kustomization.yaml)" >> $GITHUB_OUTPUT
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: .
push: false
tags: k8ssandra/k8ssandra-operator:latest,k8ssandra/k8ssandra-operator:${{ steps.parse_image_tag.outputs.image_tag }}
platforms: linux/amd64
outputs: type=docker,dest=/tmp/k8ssandra-operator.tar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Upload k8ssandra-operator image
uses: actions/upload-artifact@v3
with:
name: k8ssandra-operator
path: /tmp/k8ssandra-operator.tar
kind_e2e_tests:
runs-on: ubuntu-latest
needs: build_image
strategy:
matrix:
e2e_test:
- CreateMultiDatacenterCluster
- CreateMixedMultiDataCenterCluster
- AddDcToClusterDiffDataplane
- RemoveDcFromCluster
- CheckStargateApisWithMultiDcCluster
- CreateMultiStargateAndDatacenter
- CreateMultiReaper
- ClusterScoped/MultiDcMultiCluster
- CreateMultiMedusaJob
- MultiDcAuthOnOff
# TODO: these e2e tests started breaking after new client certificates were added. Needs fixing.
#- MultiDcEncryptionWithStargate
- MultiDcEncryptionWithReaper
- StopAndRestartDc
- CreateMultiDatacenterDseCluster
- PerNodeConfig/InitialTokens
fail-fast: false
name: ${{ matrix.e2e_test }}
env:
CGO_ENABLED: 0
KUBECONFIG_FILE: "./build/kind-kubeconfig"
CONTROL_PLANE: kind-k8ssandra-0
DATA_PLANES: kind-k8ssandra-0,kind-k8ssandra-1
steps:
- name: Raise open files limit
run: |
echo fs.file-max=1000000 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=1280 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_watches=655360 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
ulimit -a
- name: Free diskspace by removing unused packages
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request'
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: 4.x
- name: Log kustomize version
run: kustomize version
- name: Install Kind
run: go get sigs.k8s.io/kind
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download k8ssandra-operator image
uses: actions/download-artifact@v3
with:
name: k8ssandra-operator
path: /tmp
- name: Load images
run: |
docker load --input /tmp/k8ssandra-operator.tar
- name: Setup kind clusters
run: make IMG="k8ssandra/k8ssandra-operator:${{ needs.build_image.outputs.image_tag }}" create-kind-multicluster kind-load-image-multi cert-manager-multi nginx-kind-multi
- name: Run e2e test ( ${{ matrix.e2e_test }} )
run: |
e2e_test="TestOperator/${{ matrix.e2e_test }}"
args="-kubeconfigFile '${{ env.KUBECONFIG_FILE }}'"
args="$args -controlPlane '${{ env.CONTROL_PLANE }}'"
args="$args -dataPlanes '${{ env.DATA_PLANES }}'"
args="$args -imageTag ${{ needs.build_image.outputs.image_tag }}"
make E2E_TEST="$e2e_test" TEST_ARGS="$args" e2e-test
- name: Get artefact upload directory
if: ${{ failure() }}
run: |
uploaddir_name=$(echo ${{ matrix.e2e_test }}| sed 's/\//__/g')
echo 'setting uploaddir_name to' $uploaddir_name
echo "uploaddir_name=$uploaddir_name" >> $GITHUB_ENV
- name: Archive k8s logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: k8s-logs-${{ env.uploaddir_name }}
path: ./build/test