forked from strimzi/strimzi-kafka-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSMDS-210, CSMDS-271: Docker-in-docker test executor (strimzi#18)
Unit test enhancements & ryuk disablement (strimzi#20) just coping what strmzi does in .azure/templates/jobs/build/test_strimzi.yaml CSMDS-297: System test runner for parametrized job (strimzi#21) Adjusting env_setup script to use internal docker images and setup registry for minikube (strimzi#26) CSMDS-297: Systemtest executor on VPC, via quasar (strimzi#25) CSMDS-297: Checkout pr ref only in case gbn relates to strimzi pr (strimzi#30) CSMDS-374: Internalize minikube plugin images (strimzi#32) Readme about running tests in docker locally (strimzi#78) CSMDS-468: Using DOCKER_TAG if provided when setting the defaultImageTag in helm (strimzi#61) CSMDS-528: Internalize kafka-exporter tars (strimzi#86) CSMDS-499: Accepting extra args in unit test runner (strimzi#83) CSMDS-520: Bump base image version to 8.9-1161 (strimzi#85) * CSMDS-520: Bump base image version to 8.9-1161 * bump maven-builder image CSMDS-563: config-model artifact is required in local maven repo for config-model-generator CSMDS-575: Modify profile usage in execute_systemtests.sh CSMDS-364: Enabling Connect systemtests and configuring environment, test setup (strimzi#154) CSMDS-768: kafka.version override fix in strimzi unit test and docker image listing (strimzi#191) CSMDS-774: Set the MAVEN_REPO env var for strimzi systemtests for the connect-file url CSMDS-774: Ability to override maven repo of connect-file url in systemtests CSMDS-777: Set kaniko image and tiered kafka image env vars for systemtest (strimzi#4)
- Loading branch information
1 parent
9656bf4
commit f0ca15d
Showing
22 changed files
with
754 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Running Strimzi tests in docker (in docker) | ||
|
||
These scripts are shooting up an env with minikube and starts unit or system tests. | ||
|
||
## unit test | ||
``` | ||
./run_tests_in_docker.sh unit | ||
``` | ||
|
||
## system test | ||
Before running this locally, the project should be compiled via `make java_install`. | ||
``` | ||
./run_tests_in_docker.sh system <docker registry> <docker org> <docker tag> <test profile> <mvn args> | ||
``` | ||
* docker registry: `docker-private.infra.cloudera.com` | ||
* docker org: `cloudera` | ||
* docker tag: strimzi image's tag, e.g. `0.40.0.1.0.0-b264` | ||
* test profile: profile of systemtest maven module, it defines what tests will be executed, by default: `cloudera` (all tests except some exclusions) | ||
* mvn args: additional maven args | ||
|
||
example: | ||
``` | ||
./run_tests_in_docker.sh system docker-private.infra.cloudera.com cloudera 0.40.0.1.0.0-b264 cloudera -Dit.test=SecurityST | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -ex | ||
|
||
ARCH=$(uname -m) | ||
case $ARCH in | ||
armv5*) ARCH="armv5";; | ||
armv6*) ARCH="armv6";; | ||
armv7*) ARCH="arm";; | ||
aarch64) ARCH="arm64";; | ||
x86) ARCH="386";; | ||
x86_64) ARCH="amd64";; | ||
i686) ARCH="386";; | ||
i386) ARCH="386";; | ||
esac | ||
|
||
apk update && apk upgrade | ||
apk add \ | ||
bash \ | ||
bash-completion \ | ||
curl \ | ||
findutils \ | ||
helm \ | ||
kubectl \ | ||
kubectl-bash-completion \ | ||
libc6-compat \ | ||
make \ | ||
maven \ | ||
openjdk17-jdk \ | ||
yq | ||
apk cache clean | ||
|
||
curl -sLO "https://cloudera-build-us-west-1.vpc.cloudera.com/s3/ARTIFACTS/DIM-QE/strimziTesting/minikube-linux-${ARCH}" | ||
install "minikube-linux-${ARCH}" /usr/local/bin/minikube | ||
|
||
cloudera_thirdparty="docker-private.infra.cloudera.com/cloudera_thirdparty" | ||
cloudera_base="docker-private.infra.cloudera.com/cloudera_base" | ||
registry_image="${cloudera_thirdparty}/registry:2.8.3" | ||
docker run -d -p 5000:5000 "${registry_image}" | ||
|
||
MINIKUBE_MEMORY=$(free -m | grep "Mem" | awk '{print int($2*0.95)}') | ||
MINIKUBE_CPU=$(awk '$1~/cpu[0-9]/{usage=($2+$4)*100/($2+$4+$5); print $1": "usage"%"}' /proc/stat | wc -l) | ||
|
||
export MINIKUBE_WANTUPDATENOTIFICATION=false | ||
export MINIKUBE_WANTREPORTERRORPROMPT=false | ||
export MINIKUBE_HOME=$HOME | ||
export CHANGE_MINIKUBE_NONE_USER=true | ||
if [ "${ARCH}" = "amd64" ]; then | ||
curl -sLO "https://cloudera-build-us-west-1.vpc.cloudera.com/s3/ARTIFACTS/DIM-QE/strimziTesting/minikube_cache.tar.gz" | ||
tar xzf minikube_cache.tar.gz | ||
fi | ||
minikube start --force --cpus=${MINIKUBE_CPU} --memory=${MINIKUBE_MEMORY} \ | ||
--base-image="${cloudera_thirdparty}/k8s-minikube/kicbase:v0.0.42" \ | ||
--extra-config=apiserver.authorization-mode=Node,RBAC \ | ||
--insecure-registry=localhost:5000 | ||
minikube addons enable default-storageclass | ||
minikube addons enable registry --images="Registry=${registry_image},KubeRegistryProxy=${cloudera_thirdparty}/k8s-minikube/kube-registry-proxy:0.0.5" | ||
minikube addons enable registry-aliases --images="CoreDNSPatcher=${cloudera_thirdparty}/rhdevelopers/core-dns-patcher:latest,Alpine=${cloudera_base}/alpine:3.11.2,Pause=${cloudera_thirdparty}/google_containers/pause:3.1" | ||
|
||
if ! kubectl get clusterrolebinding add-on-cluster-admin; then | ||
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default | ||
fi | ||
|
||
for nodeName in $(kubectl get nodes -o custom-columns=:.metadata.name --no-headers); | ||
do | ||
echo "${nodeName}"; | ||
kubectl label node "${nodeName}" rack-key=zone; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
|
||
docker images | ||
minikube image ls --format=table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ $# -lt 1 || "${1}" != "unit" && "${1}" != "system" ]]; then | ||
echo "Usage: $0 <test type>" | ||
echo " test type: the type of tests to execute, can be 'unit' or 'system' only." | ||
exit 1 | ||
fi | ||
|
||
set -x | ||
|
||
test_type="${1}" | ||
|
||
script_dir="$(dirname "${0}")" | ||
# going back to repository root, later on the current dir will be attached as volume to the docker container | ||
cd "${script_dir}/../.." | ||
|
||
container_id=$(docker run --privileged -d -v "$(pwd)":/usr/src/project -v ~/.m2:/root/.m2 docker-private.infra.cloudera.com/cloudera_thirdparty/docker:25.0.1-dind) | ||
docker exec "${container_id}" "/usr/src/project/cloudera/testing/env_setup.sh" | ||
docker exec "${container_id}" "/usr/src/project/cloudera/testing/${test_type}_test_setup_and_run.sh" "${@:2}" | ||
result_exit_code=$? | ||
docker exec "${container_id}" "/usr/src/project/cloudera/testing/list_docker_images.sh" | ||
docker rm --force "${container_id}" | ||
|
||
exit $result_exit_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
script_dir="$(dirname "${0}")" | ||
# going back to repository root | ||
cd "${script_dir}/../.." | ||
|
||
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk | ||
|
||
export DOCKER_REGISTRY="${1:-docker-private.infra.cloudera.com}" | ||
export DOCKER_ORG="${2:-cloudera}" | ||
export DOCKER_TAG="${3:-0.38.0.1.0.0-b197}" | ||
test_group="${4:-cloudera}" | ||
|
||
# adjust packaging/install stuff via the helm_install goal | ||
chart_values="./packaging/helm-charts/helm3/strimzi-kafka-operator/values.yaml" | ||
sed -i "s/defaultImageRegistry:.*/defaultImageRegistry: ${DOCKER_REGISTRY}/g" "${chart_values}" | ||
sed -i "s/defaultImageRepository:.*/defaultImageRepository: ${DOCKER_ORG}/g" "${chart_values}" | ||
sed -i "s/defaultImageTag:.*/defaultImageTag: ${DOCKER_TAG}/g" "${chart_values}" | ||
make helm_install | ||
|
||
mvn package -pl config-model-generator -DskipTests -Dmaven.javadoc.skip=true -e -V -B | ||
|
||
mvn -B -fae \ | ||
-Dfailsafe.rerunFailingTestsCount=2 \ | ||
-DfailIfNoTests=false \ | ||
-Dfailsafe.failIfNoSpecifiedTests=false \ | ||
-Dskip.surefire.tests \ | ||
verify \ | ||
-pl systemtest -P"${test_group}" "${@:5}" |
Oops, something went wrong.