Skip to content

Commit

Permalink
馃彈 Compute the startup time for sauce connect (ampproject#20986)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored and bramanudom committed Mar 22, 2019
1 parent 3408c48 commit 08108db
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build-system/sauce_connect/start_sauce_connect.sh
Expand Up @@ -34,7 +34,11 @@ LOG_FILE="sauce_connect_log"
OUTPUT_FILE="sauce_connect_output"
READY_FILE="sauce_connect_ready"
READY_DELAY_SECS=120
LOG_PREFIX=$(YELLOW "start_sauce_connect.sh")
LOG_PREFIX=$(YELLOW "start_sauce_connect.sh:")

# Start a timer to track how long setup took
START_TIME=$( date +%s )
echo "$LOG_PREFIX Starting $(CYAN "start_sauce_connect.sh")..."

# Check the status of the Sauce Labs service
echo "$LOG_PREFIX Fetching current Sauce Labs service status from $(CYAN "$STATUS_URL")..."
Expand Down Expand Up @@ -85,6 +89,7 @@ else
TUNNEL_IDENTIFIER="$TRAVIS_JOB_NUMBER"
fi


# Launch proxy and wait for a tunnel to be created.
echo "$LOG_PREFIX Launching $(CYAN "$BINARY_FILE")"
"$BINARY_FILE" --verbose --tunnel-identifier "$TUNNEL_IDENTIFIER" --readyfile "$READY_FILE" --pidfile "$PID_FILE" --logfile "$LOG_FILE" 1>"$OUTPUT_FILE" 2>&1 &
Expand All @@ -97,6 +102,9 @@ do
PID="$(cat "$PID_FILE")"
TUNNEL_ID="$(grep -oP "Tunnel ID: \K.*$" "$OUTPUT_FILE")"
echo "$LOG_PREFIX Sauce Connect Proxy with tunnel ID $(CYAN "$TUNNEL_ID") and identifier $(CYAN "$TUNNEL_IDENTIFIER") is now running as pid $(CYAN "$PID")"
END_TIME=$( date +%s )
TOTAL_TIME=$(( END_TIME - START_TIME ))
echo "$LOG_PREFIX Done running $(CYAN "start_sauce_connect.sh") Total time: $(CYAN "$TOTAL_TIME"s)"
break
else
# Continue waiting.
Expand Down

0 comments on commit 08108db

Please sign in to comment.