-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(CI): Run stress test async for speed 🚀
- Loading branch information
Showing
5 changed files
with
84 additions
and
6 deletions.
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 |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
# log & pid files | ||
/*.log | ||
/*.pid | ||
/*.success | ||
|
||
# docker.json [with credentials] | ||
/docker.json | ||
|
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
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
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,19 @@ | ||
#!/usr/bin/env bash | ||
# | ||
if [[ ${#} -lt 2 ]]; then | ||
echo "Usage: ${0} NAME COMMAND [OPTIONS]" | ||
exit 1 | ||
fi | ||
|
||
declare -r NAME=${1}; shift | ||
declare -r EXEC=${@} | ||
|
||
if [[ -f ${NAME}.pid ]]; then | ||
echo "FATAL: ${NAME}.pid file already exists!" | ||
exit 1 | ||
fi | ||
|
||
rm -f ${NAME}.success | ||
|
||
bash -c "${EXEC} && touch ${NAME}.success" &>${NAME}.log & | ||
echo ${!} >${NAME}.pid |
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,47 @@ | ||
#!/usr/bin/env bash | ||
# | ||
declare MODES="silent|verbose" | ||
|
||
if [[ ${#} -ne 3 ]]; then | ||
echo "Usage: ${0} NAME TIME ${MODES}" | ||
exit 1 | ||
fi | ||
|
||
declare -r NAME=${1} | ||
declare -r TIME=${2} | ||
declare -r MODE=${3} | ||
|
||
if [[ ! ${MODE} =~ ${MODES} ]]; then | ||
echo "FATAL: Invalid mode: ${MODE} (could be \"${MODES}\")" | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -f ${NAME}.pid ]]; then | ||
echo 'FATAL: nothing to wait for!' | ||
exit 1 | ||
fi | ||
|
||
declare -r W_PID=$(cat ${NAME}.pid) | ||
RUN_TIME=0 | ||
while [[ -e /proc/${W_PID} ]]; do | ||
if [[ ${RUN_TIME} -gt ${TIME} ]]; then | ||
echo; cat ${NAME}.log | ||
echo "ERROR: Timeout reached: ${TIME} seconds" | ||
exit 124 | ||
fi | ||
|
||
sleep 1 | ||
|
||
echo -n . | ||
((RUN_TIME++)) | ||
done | ||
|
||
if [[ ${MODE} == "verbose" || ! -f ${NAME}.success ]]; then | ||
echo; cat ${NAME}.log | ||
fi | ||
|
||
STATUS=0; [[ -f ${NAME}.success ]] || STATUS=1 | ||
|
||
rm -f ${NAME}.pid ${NAME}.log ${NAME}.success | ||
|
||
exit ${STATUS} |