diff --git a/system-test/integration_test.go b/system-test/integration_test.go index 3a2eae38..f310ac24 100644 --- a/system-test/integration_test.go +++ b/system-test/integration_test.go @@ -47,33 +47,12 @@ var ( const cloudScope = "https://www.googleapis.com/auth/cloud-platform" const startupTemplate = ` -#! /bin/bash - -( - -# Signal any unexpected error. -trap 'echo "{{.ErrorString}}"' ERR - -# Shut down the VM in 5 minutes after this script exits -# to stop accounting the VM for billing and cores quota. -trap "sleep 300 && poweroff" EXIT - -retry() { - for i in {1..3}; do - "${@}" && return 0 - done - return 1 -} +{{- template "prologue" . }} npm_install() { timeout 60 npm install "${@}" } -# Fail on any error -set -eo pipefail - -# Display commands being run -set -x # Install git retry apt-get update >/dev/null retry apt-get -y -q install git >/dev/null @@ -120,8 +99,7 @@ GCLOUD_PROFILER_LOGLEVEL=5 GAE_SERVICE={{.Service}} node --trace-warnings build/ # Indicate to test that script has finished running echo "{{.FinishString}}" -# Write output to serial port 2 with timestamp. -) 2>&1 | while read line; do echo "$(date): ${line}"; done >/dev/ttyS1 +{{ template "epilogue" . -}} ` type profileSummary struct { @@ -193,7 +171,7 @@ func TestAgentIntegration(t *testing.T) { t.Fatalf("failed to initialize compute Service: %v", err) } - template, err := template.New("startupScript").Parse(startupTemplate) + template, err := proftest.BaseStartupTmpl.Parse(startupTemplate) if err != nil { t.Fatalf("failed to parse startup script template: %v", err) }