Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions run/markdown-preview/editor/test/retry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,32 @@
# If first cmd executes successfully then execute second cmd
runIfSuccessful() {
echo "running: $1"
$($1 > /dev/null)
$($1 >/dev/null)
if [ $? -eq 0 ]; then
echo "running: $2"
$($2 > /dev/null)
$($2 >/dev/null)
fi
}

# Define max retries
max_attempts=3;
attempt_num=1;
max_attempts=3
attempt_num=1

arg1="$1"
arg2="$2"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
cmd="$arg1"
else
cmd="runIfSuccessful \"$arg1\" \"$arg2\""
fi

until eval $cmd
do
if ((attempt_num==max_attempts))
then
echo "Attempt $attempt_num / $max_attempts failed! No more retries left!"
exit
else
echo "Attempt $attempt_num / $max_attempts failed!"
sleep $((attempt_num++))
fi
until eval $cmd; do
if ((attempt_num == max_attempts)); then
echo "Attempt $attempt_num / $max_attempts failed! No more retries left!"
exit 1
else
echo "Attempt $attempt_num / $max_attempts failed!"
sleep $((attempt_num++))
fi
done
5 changes: 4 additions & 1 deletion run/markdown-preview/editor/test/system.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ describe('End-to-End Tests', () => {
`gcloud builds submit --project ${GOOGLE_CLOUD_PROJECT} ` +
'--config ../renderer/test/e2e_test_setup.yaml ' +
`--substitutions _SERVICE=renderer-${SERVICE_NAME},_REGION=${REGION}`;

if (SAMPLE_VERSION) buildRendererCmd += `,_VERSION=${SAMPLE_VERSION}`;
if (SERVICE_ACCOUNT) buildRendererCmd += `,_SERVICE_ACCOUNT=${SERVICE_ACCOUNT}`;
if (SERVICE_ACCOUNT) {
buildRendererCmd += `,_SERVICE_ACCOUNT=${SERVICE_ACCOUNT}`;
}

console.log('Starting Cloud Build for Renderer service...');
execSync(buildRendererCmd, {cwd: '../renderer'});
Expand Down
29 changes: 13 additions & 16 deletions run/markdown-preview/renderer/test/retry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,32 @@
# If first cmd executes successfully then execute second cmd
runIfSuccessful() {
echo "running: $1"
$($1 > /dev/null)
$($1 >/dev/null)
if [ $? -eq 0 ]; then
echo "running: $2"
$($2 > /dev/null)
$($2 >/dev/null)
fi
}

# Define max retries
max_attempts=3;
attempt_num=1;
max_attempts=3
attempt_num=1

arg1="$1"
arg2="$2"

if [ $# -eq 1 ]
then
if [ $# -eq 1 ]; then
cmd="$arg1"
else
cmd="runIfSuccessful \"$arg1\" \"$arg2\""
fi

until eval $cmd
do
if ((attempt_num==max_attempts))
then
echo "Attempt $attempt_num / $max_attempts failed! No more retries left!"
exit
else
echo "Attempt $attempt_num / $max_attempts failed!"
sleep $((attempt_num++))
fi
until eval $cmd; do
if ((attempt_num == max_attempts)); then
echo "Attempt $attempt_num / $max_attempts failed! No more retries left!"
exit 1
else
echo "Attempt $attempt_num / $max_attempts failed!"
sleep $((attempt_num++))
fi
done
2 changes: 0 additions & 2 deletions run/markdown-preview/renderer/test/system.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('End-to-End Tests', () => {
const {SERVICE_ACCOUNT} = process.env;
const REGION = 'us-central1';


let BASE_URL;
before(async () => {
// Deploy service using Cloud Build
Expand All @@ -55,7 +54,6 @@ describe('End-to-End Tests', () => {
);
BASE_URL = url.toString('utf-8').trim();
if (!BASE_URL) throw Error('Cloud Run service URL not found');

});

after(() => {
Expand Down
Loading