This component contains unit and integration tests. Some of them - like the consumer ones - require a Kubernetes environment.
It is possible to run the integration tests using Kind. To do so, follow these steps:
kind create cluster
kubectl config set-context --current --namespace=default
kubectl create serviceaccount camel
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: Secret metadata: name: camel-token annotations: kubernetes.io/service-account.name: camel type: kubernetes.io/service-account-token EOF
export KUBE_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='camel')].data.token}"|base64 --decode)
export KIND_PORT=$(docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}}{{(index $conf 0).HostPort}}{{end}}' kind-control-plane) export KUBE_HOST=https://localhost:$KIND_PORT
mvn -Dkubernetes.test.auth="$KUBE_TOKEN" -Dkubernetes.test.host=$KUBE_HOST -Dkubernetes.test.host.k8s=true clean verify
It is possible to run the integration tests using Minikube. To do so, follow these steps:
minikube start
export KUBE_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode)
Find out the URL where the control plane is running:
kubectl cluster-info
And then set that as export, for example:
export KUBE_HOST=https://127.0.0.1:50179
mvn -Dkubernetes.test.auth="$KUBE_TOKEN" -Dkubernetes.test.host=$KUBE_HOST -Dkubernetes.test.host.k8s=true clean verify