|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2019 The Kubernetes Authors. |
| 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 | + |
| 17 | +# set -euo pipefail |
| 18 | + |
| 19 | +export set AZURE_CREDENTIAL_FILE=/tmp/azure.json |
| 20 | + |
| 21 | +# run test on AzurePublicCloud |
| 22 | +if [ -v aadClientSecret ]; then |
| 23 | + cp test/integration/azure.json $AZURE_CREDENTIAL_FILE |
| 24 | + |
| 25 | + sed -i "s/tenantId-input/$tenantId/g" $AZURE_CREDENTIAL_FILE |
| 26 | + sed -i "s/subscriptionId-input/$subscriptionId/g" $AZURE_CREDENTIAL_FILE |
| 27 | + sed -i "s/aadClientId-input/$aadClientId/g" $AZURE_CREDENTIAL_FILE |
| 28 | + sed -i "s#aadClientSecret-input#$aadClientSecret#g" $AZURE_CREDENTIAL_FILE |
| 29 | + sed -i "s/resourceGroup-input/$resourceGroup/g" $AZURE_CREDENTIAL_FILE |
| 30 | + sed -i "s/location-input/$location/g" $AZURE_CREDENTIAL_FILE |
| 31 | + |
| 32 | + go test -v ./test/sanity/... |
| 33 | +fi |
| 34 | + |
| 35 | +# run test on AzureChinaCloud |
| 36 | +if [ -v aadClientSecret_china ]; then |
| 37 | + cp test/integration/azure.json $AZURE_CREDENTIAL_FILE |
| 38 | + |
| 39 | + sed -i "s/AzurePublicCloud/AzureChinaCloud/g" $AZURE_CREDENTIAL_FILE |
| 40 | + sed -i "s/tenantId-input/${tenantId_china}/g" $AZURE_CREDENTIAL_FILE |
| 41 | + sed -i "s/subscriptionId-input/${subscriptionId_china}/g" $AZURE_CREDENTIAL_FILE |
| 42 | + sed -i "s/aadClientId-input/${aadClientId_china}/g" $AZURE_CREDENTIAL_FILE |
| 43 | + sed -i "s#aadClientSecret-input#${aadClientSecret_china}#g" $AZURE_CREDENTIAL_FILE |
| 44 | + sed -i "s/resourceGroup-input/${resourceGroup_china}/g" $AZURE_CREDENTIAL_FILE |
| 45 | + sed -i "s/location-input/${location_china}/g" $AZURE_CREDENTIAL_FILE |
| 46 | + |
| 47 | + go test -v ./test/sanity/... |
| 48 | +fi |
| 49 | + |
| 50 | +# make it always succeed for now |
| 51 | +exit 0 |
0 commit comments