A operator that injects the jacoco agent into pods so you can collect coverage data when running tests against Java services deployed in kubernetes.
If you don't already have cert manager installed you will need to run:
helm repo add jetstack https://charts.jetstack.io && helm repo update && \
helm upgrade --install --namespace cert-manager --create-namespace \
cert-manager jetstack/cert-manager --set installCRDs=true --debug --waitAdd the helm repos helm repo add k8s https://curium-rocks.github.io/k8s-jacoco-operator fetch updates helm repo update.
Verify it worked helm search repo k8s and you should see something like.
NAME CHART VERSION APP VERSION DESCRIPTION
k8s/k8s-jacoco-operator... 0.1.0 0.1.0 ......
Deploy the operator helm upgrade --install jacoco-operator k8s/k8s-jacoco-operator
Once you've deployed the operator you can add the following annotations to your pods in the same namespace and they will have the jacoco agent copied in and the appropriate env vars set so the agent used and the code is instrumented.
jacoco-operator.curium.rocks/inject: 'true',
jacoco-operator.curium.rocks/target-containers: 'api'Coverage data will be saved to a PVC on process exit, you can force this with a rollout on a deployment or using exec to send a SIGINT signal to the process.
The following scripts are included in the NPM project configuration
lintlints the source code using eslintlint:fixautomatically fixes any lint errors that can be fixed automaticallytestuses jest to run test suitestest:e2eruns e2e test suite, this requires an active helm:deploybuildcompiles the typescript into js and places it in thedistfolderbuild:imagebuilds the container imageminikube:startcreate a minikube k8s clusterminikube:stopstop minikube but do not deleteminikube:deletedelete the minikube clusterhelm:addReposadds helm reposhelm:deployCertManagerdeploy cert-manager for TLShelm:deploydeploy the app to k8s using helmhelm:templateprint the k8s yaml that would be applied to k8s when usinghelm:deployhelm:uninstallremove the app from k8shelm:uninstallCertManagerremove cert-manager from the k8s cluster