Skip to content

Commit

Permalink
fix: video container wait capabilities fully before extracting details
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Sep 12, 2024
1 parent af5f36e commit 65933cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Video/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN apt-get -qqy update \
&& apt-get upgrade -yq \
&& apt-get -qqy --no-install-recommends install \
supervisor x11-xserver-utils x11-utils libxcb1-dev curl jq python3-pip tzdata acl unzip python3-psutil python3-setuptools \
supervisor x11-xserver-utils x11-utils libxcb1-dev curl jq python3-pip tzdata acl unzip python3-psutil \
&& pip install --no-cache-dir --upgrade --break-system-packages setuptools \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#===================
Expand Down
4 changes: 3 additions & 1 deletion Video/video_graphQLQuery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TEST_NAME_CAP=${TEST_NAME_CAP:-"se:name"}
VIDEO_NAME_CAP=${VIDEO_NAME_CAP:-"se:videoName"}
VIDEO_FILE_NAME_TRIM=${SE_VIDEO_FILE_NAME_TRIM_REGEX:-"[:alnum:]-_"}
VIDEO_FILE_NAME_SUFFIX=${SE_VIDEO_FILE_NAME_SUFFIX:-"true"}
poll_interval=${SE_VIDEO_POLL_INTERVAL:-1}

if [ -n "${GRAPHQL_ENDPOINT}" ]; then
current_check=1
Expand All @@ -32,9 +33,10 @@ if [ -n "${GRAPHQL_ENDPOINT}" ]; then
# Check if the response contains "capabilities"
if [[ "$endpoint_checks" = "404" ]] || [[ $current_check -eq $retry_time ]]; then
break
elif [[ "$endpoint_checks" = "200" ]] && [[ $(jq -e '.data.session.capabilities | fromjson | ."'browserName'"' /tmp/graphQL_${SESSION_ID}.json >/dev/null) -eq 0 ]]; then
elif [[ "$endpoint_checks" = "200" ]] && [[ $(jq -e '.data.session.capabilities | fromjson | ."'se:vncEnabled'"' /tmp/graphQL_${SESSION_ID}.json >/dev/null) -eq 0 ]]; then
break
fi
sleep ${poll_interval}
done

if [[ -f "/tmp/graphQL_${SESSION_ID}.json" ]]; then
Expand Down
4 changes: 4 additions & 0 deletions charts/selenium-grid/configs/distributor/distributorProbe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ SESSION_COUNT=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X PO

MAX_SESSION=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { maxSession } }"}' -s ${GRID_GRAPHQL_URL} | jq -r '.data.grid.maxSession')

if [ "${SE_LOG_LISTEN_GRAPHQL:-"false"}" = "true" ]; then
echo "$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionCount, maxSession, totalSlots }, nodesInfo { nodes { id, status, sessionCount, maxSession, slotCount, stereotypes, sessions { id, capabilities, slot { id, stereotype } } } }, sessionsInfo { sessionQueueRequests } }"}' -s ${GRID_GRAPHQL_URL} )"
fi

if [ ${SESSION_QUEUE_SIZE} -gt 0 ] && [ ${SESSION_COUNT} -eq 0 ]; then
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Session Queue Size: ${SESSION_QUEUE_SIZE}, Session Count: ${SESSION_COUNT}, Max Session: ${MAX_SESSION}"
echo "$(date ${ts_format}) DEBUG [${probe_name}] - It seems the Distributor is delayed in processing a new session in the queue. Probe checks failed."
Expand Down
4 changes: 3 additions & 1 deletion tests/charts/ci/base-auth-ingress-values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
global:
seleniumGrid:
logLevel: INFO
stdoutProbeLog: false
stdoutProbeLog: true

serverConfigMap:
env:
Expand All @@ -27,6 +27,8 @@ hub:
value: "15"
- name: SE_REJECT_UNSUPPORTED_CAPS
value: "false"
- name: SE_LOG_LISTEN_GRAPHQL
value: "true"

components:
extraEnvironmentVariables: *extraEnvironmentVariables
Expand Down

0 comments on commit 65933cd

Please sign in to comment.