Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彈 Compute the startup time for sauce connect #20986

Merged
merged 2 commits into from Feb 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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