Skip to content

Commit

Permalink
[issues-k8s-support] - Add Kubernetes integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobrz committed Nov 4, 2024
1 parent 09681ca commit fe2dc13
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
84 changes: 84 additions & 0 deletions .github/workflows/kubernetes-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Kubernetes E2E Tests

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths-ignore:
- 'docs/**'
- 'ide-config/**'
- '**.md'

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-e2e-intersmash-${{ github.ref }}
cancel-in-progress: true

jobs:
minikube:
name: K8S
runs-on: ubuntu-latest
if: github.repository == 'Intersmash/intersmash'
strategy:
fail-fast: false
matrix:
kubernetes: [v1.31.0, v1.30.0]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
driver: docker
container runtime: containerd
minikube version: 'v1.32.0'
kubernetes version: 'v1.30.0'
github token: ${{ secrets.GITHUB_TOKEN }}
start args: "--memory='4gb' --cpus='2'"
- name: Enable minikube registry
run: |
minikube addons enable registry
kubectl port-forward --namespace kube-system service/registry 5000:80 &
- name: Cache .m2 registry
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: cache-e2e-${{ github.sha }}-${{ github.run_id }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install and Run Integration Tests
run: |
set -x
# cat our ~/.kube/config contents
#
cat ~/.kube/config
#
# operator-sdk must be installed manually, see
#
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.37.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
operator-sdk olm install
#
# set the Kubernetes hostname that will resolve to the minikube IP
#
export KUBERNETES_HOSTNAME=host.minikube.internal
#
# run...
#
mkdir local-repo
mvn clean install -Dmaven.repo.local=./local-repo -DskipTests
mvn test -Dmaven.repo.local=./local-repo -pl testsuite/ -Pts.k8s \
-Dintersmash.kubernetes.url=https://$( minikube ip):8443 \
-Dintersmash.kubernetes.hostname=$KUBERNETES_HOSTNAME \
-Dintersmash.kubernetes.namespace=test-k8s-1 \
-Dintersmash.olm.operators.catalog_source=community-operators \
-Dintersmash.olm.operators.namespace=olm \
-Dintersmash.hyperfoil.operators.catalog_source=operatorhubio-catalog
11 changes: 10 additions & 1 deletion testsuite/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<intersmash.test.excludedGroups.by.execution-profile>ts.not-for-community</intersmash.test.excludedGroups.by.execution-profile>
<!-- And being community oriented, no tests are excluded based on WildFly target distribution (e.g.: WildFly can run Bootable JAR tests) -->
<intersmash.test.excludedGroups.by.wildfly-target-distribution>ts.no-test-excluded.default</intersmash.test.excludedGroups.by.wildfly-target-distribution>
<!-- And being community oriented, let's just test on k8s by default -->
<intersmash.test.excludedGroups.by.target-platform>ts.openshift</intersmash.test.excludedGroups.by.target-platform>
</properties>

<dependencies>
Expand Down Expand Up @@ -98,7 +100,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.children="append">
<excludedGroups>${intersmash.test.excludedGroups.by.execution-profile},${intersmash.test.excludedGroups.by.wildfly-target-distribution}</excludedGroups>
<excludedGroups>${intersmash.test.excludedGroups.by.execution-profile},${intersmash.test.excludedGroups.by.wildfly-target-distribution},${intersmash.test.excludedGroups.by.target-platform}</excludedGroups>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -136,6 +138,13 @@
<intersmash.test.excludedGroups.by.wildfly-target-distribution>ts.wildfly.requires-bootable-jar</intersmash.test.excludedGroups.by.wildfly-target-distribution>
</properties>
</profile>
<profile>
<id>ts.openshift</id>
<properties>
<!-- Exclude k8s tests -->
<intersmash.test.excludedGroups.by.target-platform>ts.k8s</intersmash.test.excludedGroups.by.target-platform>
</properties>
</profile>
</profiles>

</project>

0 comments on commit fe2dc13

Please sign in to comment.