ci: move local and saucelabs unit tests to circle (#27937)
Moving the tests over to CircleCI in pretty much "as-is" state just so that we can drop the dependency on Travis. In the followup changes we plan to migrate these tests to run on sauce under bazel. @gregmagolan is working on that. I've previously verified that all the tests executed in legacy-unit-tests-local already under bazel. Therefore the legacy-unit-tests-local job is strictly not necessary any more, but given how flaky legacy-unit-tests-saucelabs is, it is good to have the -local job just so that we can quickly determine if any failure is a flake or legit issue (the bazel version of these tests could theoretically run in a slightly different way and fail or not fail in a different way, so having -lcoal job is just an extra safety check). This change was coauthored with @devversion PR Close #27937
This commit is contained in:

committed by
Kara Erickson

parent
c1dacdd890
commit
04ca3bcf10
25
scripts/saucelabs/start-tunnel.sh
Executable file
25
scripts/saucelabs/start-tunnel.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x -u -e -o pipefail
|
||||
|
||||
readonly currentDir=$(cd $(dirname $0); pwd)
|
||||
|
||||
# Command arguments that will be passed to sauce-connect.
|
||||
sauceArgs=""
|
||||
|
||||
if [[ ! -z "${SAUCE_READY_FILE}" ]]; then
|
||||
sauceArgs="${sauceArgs} --readyfile ${SAUCE_READY_FILE}"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${SAUCE_PID_FILE}" ]]; then
|
||||
mkdir -p $(dirname ${SAUCE_PID_FILE})
|
||||
sauceArgs="${sauceArgs} --pidfile ${SAUCE_PID_FILE}"
|
||||
fi
|
||||
|
||||
if [[ ! -z "${SAUCE_TUNNEL_IDENTIFIER}" ]]; then
|
||||
sauceArgs="${sauceArgs} --tunnel-identifier ${SAUCE_TUNNEL_IDENTIFIER}"
|
||||
fi
|
||||
|
||||
echo "Starting Sauce Connect. Passed arguments: ${sauceArgs}"
|
||||
|
||||
${currentDir}/../../node_modules/sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${sauceArgs}
|
27
scripts/saucelabs/stop-tunnel.sh
Executable file
27
scripts/saucelabs/stop-tunnel.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Disable printing of any executed command because this would cause a lot
|
||||
# of spam due to the loop.
|
||||
set +x -u -e -o pipefail
|
||||
|
||||
if [[ ! -f ${SAUCE_PID_FILE} ]]; then
|
||||
echo "Could not find Saucelabs tunnel PID file. Cannot stop tunnel.."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Shutting down Sauce Connect tunnel"
|
||||
|
||||
# The process id for the sauce-connect instance is stored inside of the pidfile.
|
||||
tunnelProcessId=$(cat ${SAUCE_PID_FILE})
|
||||
|
||||
# Kill the process by using the PID that has been read from the pidfile. Note that
|
||||
# we cannot use killall because CircleCI base container images don't have it installed.
|
||||
kill ${tunnelProcessId}
|
||||
|
||||
while (ps -p ${tunnelProcessId} &> /dev/null); do
|
||||
printf "."
|
||||
sleep .5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Sauce Connect tunnel has been shut down"
|
26
scripts/saucelabs/wait-for-tunnel.sh
Executable file
26
scripts/saucelabs/wait-for-tunnel.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Disable printing of any executed command because this would cause a lot
|
||||
# of spam due to the loop.
|
||||
set +x -u -e -o pipefail
|
||||
|
||||
# Waits for Saucelabs Connect to be ready before executing any tests.
|
||||
counter=0
|
||||
|
||||
while [[ ! -f ${SAUCE_READY_FILE} ]]; do
|
||||
counter=$((counter + 1))
|
||||
|
||||
# Counter needs to be multiplied by two because the while loop only sleeps a half second.
|
||||
# This has been made in favor of better progress logging (printing dots every half second)
|
||||
if [ $counter -gt $[${SAUCE_READY_FILE_TIMEOUT} * 2] ]; then
|
||||
echo ""
|
||||
echo "Timed out after ${SAUCE_READY_FILE_TIMEOUT} seconds waiting for tunnel ready file"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Connected to Saucelabs"
|
Reference in New Issue
Block a user