Skip to content

Commit

Permalink
test(chart): collect kubectl logs from all pods
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Feb 26, 2024
1 parent 46684d5 commit be90342
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'Test parameter for different request timeout'
required: false
default: '370'
log-level:
description: 'Test parameter for different log level'
required: false
default: 'FINE'
schedule:
- cron: '0 0 * * *'

Expand Down Expand Up @@ -102,6 +106,7 @@ jobs:
echo "AUTOSCALING_POLL_INTERVAL=${AUTOSCALING_POLL_INTERVAL}" >> $GITHUB_ENV
env:
AUTOSCALING_POLL_INTERVAL: ${{ github.event.inputs.request-timeout || '370' }}
LOG_LEVEL: ${{ github.event.inputs.log-level || 'FINE' }}
- name: Test Selenium Grid on Kubernetes ${{ matrix.k8s-version }} with Autoscaling ${{ matrix.test-strategy }}
uses: nick-invision/retry@master
with:
Expand Down
10 changes: 10 additions & 0 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ CHART_ENABLE_INGRESS_HOSTNAME=${CHART_ENABLE_INGRESS_HOSTNAME:-"false"}
CHART_ENABLE_BASIC_AUTH=${CHART_ENABLE_BASIC_AUTH:-"false"}
BASIC_AUTH_USERNAME=${BASIC_AUTH_USERNAME:-"sysAdminUser"}
BASIC_AUTH_PASSWORD=${BASIC_AUTH_PASSWORD:-"myStrongPassword"}
LOG_LEVEL=${LOG_LEVEL:-"FINE"}

cleanup() {
# Get the list of pods
pods=$(kubectl get pods -n ${SELENIUM_NAMESPACE} -o jsonpath='{.items[*].metadata.name}')
# Iterate over the pods and print their logs
for pod in $pods; do
echo "Logs for pod $pod"
kubectl logs -n ${SELENIUM_NAMESPACE} $pod > tests/tests/pod_logs_${pod}.txt
done
if [ "${SKIP_CLEANUP}" = "false" ]; then
echo "Clean up chart release and namespace"
helm delete ${RELEASE_NAME} --namespace ${SELENIUM_NAMESPACE}
Expand All @@ -56,6 +64,7 @@ on_failure() {
# Trap ERR signal and call on_failure function
trap 'on_failure' ERR EXIT

rm -rf tests/tests/*
touch tests/tests/describe_all_resources_${MATRIX_BROWSER}.txt

if [ -f .env ]
Expand All @@ -82,6 +91,7 @@ HELM_COMMAND_SET_IMAGES=" \
--set autoscaling.scaledOptions.pollingInterval=${AUTOSCALING_POLL_INTERVAL} \
--set tracing.enabled=${CHART_ENABLE_TRACING} \
--set isolateComponents=${CHART_FULL_DISTRIBUTED_MODE} \
--set global.seleniumGrid.logLevel=${LOG_LEVEL} \
"

if [ "${CHART_ENABLE_INGRESS_HOSTNAME}" = "true" ]; then
Expand Down

0 comments on commit be90342

Please sign in to comment.