Skip to content

Commit

Permalink
fix: update go installation method (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
psx95 authored Dec 13, 2022
1 parent 3dd65e9 commit 07f69a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion system-test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
pr = flag.Int("pr", 0, "git pull request to test")
runBackoffTest = flag.Bool("run_backoff_test", false, "Enables the backoff integration test. This integration test requires over 45 mins to run, so it is not run by default.")

runID = strings.Replace(time.Now().Format("2006-01-02-15-04-05.000000-0700"), ".", "-", -1)
runID = strings.ToLower(strings.Replace(time.Now().Format("2006-01-02-15-04-05.000000-MST"), ".", "-", -1))
benchFinishString = "benchmark application(s) complete"
errorString = "failed to set up or run the benchmark"
)
Expand Down
26 changes: 15 additions & 11 deletions system-test/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ set -x

cd $(dirname $0)/..

git config --global --add safe.directory /tmpfs/src/github/cloud-profiler-nodejs

SERVICE_KEY="${KOKORO_KEYSTORE_DIR}/72935_cloud-profiler-e2e-service-account-key"
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
Expand All @@ -27,22 +29,24 @@ export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}"
# Run test.
cd "system-test"

go version

# Ensure a newer version of Go is used so it is compatible with newer libraries.
# Here we install v1.17.7 which is the current version as of when this code
# was written, following instructions from https://go.dev/doc/manage-install.
# Go modules might not be on for previous versions of Go, so we also have to
# enable the module system explicitly.
export GO111MODULE=on
go install golang.org/dl/go1.17.7
go1.17.7 download
# The current Go version in the VM is 1.18.4, however we explicitly set it to
# pin the Go dependency to v1.18.4 for consistency.
retry sudo apt-get install -y wget

wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

# Initializing go modules allows our dependencies to install versions of their
# dependencies specified by their go.mod files. This reduces the likelihood of
# dependencies breaking this test.
go1.17.7 version
go1.17.7 mod init e2e
retry go1.17.7 get cloud.google.com/go/profiler/proftest@HEAD
retry go1.17.7 test -c -tags=integration .
go version
go mod init e2e
retry go get cloud.google.com/go/profiler/proftest@HEAD
retry go test -c -tags=integration .

if [ "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" = "" ]; then
./e2e.test -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" -run_backoff_test=true
Expand Down

0 comments on commit 07f69a7

Please sign in to comment.