1#!/bin/bash
2
3# Copyright 2020 Google Inc. All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17retry() {
18  for i in {1..3}; do
19  [ $i == 1 ] || sleep 10  # Backing off after a failed attempt.
20    "${@}" && return 0
21  done
22  return 1
23}
24
25# Fail on any error.
26set -eo pipefail
27
28# Display commands being run.
29set -x
30
31cd $(dirname $0)/..
32
33export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_KEYSTORE_DIR}/72935_cloud-profiler-e2e-service-account-key"
34export GCLOUD_TESTS_GOLANG_PROJECT_ID="cloud-profiler-e2e"
35
36# Run test.
37retry go mod download
38go test -run TestAgentIntegration -run_only_profiler_backoff_test -timeout 1h
39