forked from chainguard-images/images
-
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.
k8s-sidecar: add smoke test (chainguard-images#1994)
* k8s-sidecar: add smoke test Signed-off-by: Furkan Türkal <[email protected]> Co-authored-by: Batuhan <[email protected]> * fix typo Signed-off-by: Batuhan Apaydin <[email protected]> * fix the tests Signed-off-by: Batuhan Apaydin <[email protected]> --------- Signed-off-by: Furkan Türkal <[email protected]> Signed-off-by: Batuhan Apaydin <[email protected]> Co-authored-by: Batuhan <[email protected]>
- Loading branch information
1 parent
e0713eb
commit 1c2a816
Showing
2 changed files
with
77 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit -o nounset -o errtrace -o pipefail -x | ||
|
||
tmpdir=$(mktemp -d) && cd "$tmpdir" | ||
curl -sLO https://raw.githubusercontent.com/fabianlee/blogcode/master/prometheus/pod-count-dashboard.yaml | ||
sed -i'' -i 's/namespace: prom//g' pod-count-dashboard.yaml | ||
|
||
kubectl apply -n ${NAMESPACE} -f pod-count-dashboard.yaml | ||
|
||
PASSWORD=$(kubectl get secret ${NAME}-grafana -n ${NAMESPACE} -o jsonpath='{.data.admin-password}' | base64 --decode) | ||
|
||
kubectl port-forward -n ${NAMESPACE} service/${NAME}-grafana 3000:80 & | ||
pid=$! | ||
trap "kill -9 $pid" EXIT | ||
|
||
sleep 5 | ||
|
||
RESPONSE=$(curl -u admin:${PASSWORD} --retry 5 --retry-all-errors "http://localhost:3000/api/search?query=kubernetes%20pod%20count") | ||
|
||
if [ "$(echo "$RESPONSE" | jq length)" -eq 0 ]; then | ||
echo "Grafana should have at least one Dashboard, exiting..." | ||
exit 1 | ||
fi | ||
|
||
echo "$RESPONSE" | jq '.[].title' | grep -i "kubernetes pod count" |
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