Skip to content

Commit 2563b99

Browse files
anandaraothechenky
authored andcommitted
Update run_tests.sh to accept CI tokens (#484)
* Update run_tests.sh to accept CI tokens The integration tests now accept CI tokens obtained from firebase login:ci. * Update run_tests.sh
1 parent 6c5ffdc commit 2563b99

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

integration_test/run_tests.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@
44
set -e
55

66
function usage {
7-
echo "Usage: $0 <project_id>"
7+
echo "Usage: $0 <project_id> [<token>]"
88
exit 1
99
}
1010

11-
# This script takes in one argument specifying a project_id
12-
# Example usage (from root dir):
11+
# This script takes in one required argument specifying a project_id and an
12+
# optional arguement for a CI token that can be obtained by running
13+
# `firebase login:ci`
14+
# Example usage (from root dir) without token:
1315
# ./integration_test/run_tests.sh chenky-test-proj
16+
# Example usage (from root dir) with token:
17+
# ./integration_test/run_tests.sh chenky-test-proj $TOKEN
1418
if [[ $1 == "" ]]; then
1519
usage
1620
fi
1721

22+
TOKEN=""
23+
if [[ $2 != "" ]]; then
24+
TOKEN=$2
25+
fi
26+
1827
PROJECT_ID=$1
1928

2029
# Directory where this script lives.
@@ -63,7 +72,11 @@ function deploy {
6372
cd $DIR
6473
./functions/node_modules/.bin/tsc -p functions/
6574
# Deploy functions, and security rules for database and Firestore. If the deploy fails, retry twice
66-
for i in 1 2 3; do firebase deploy --project=$PROJECT_ID --only functions,database,firestore && break; done
75+
if [[ $TOKEN == "" ]]; then
76+
for i in 1 2 3; do firebase deploy --project=$PROJECT_ID --only functions,database,firestore && break; done
77+
else
78+
for i in 1 2 3; do firebase deploy --project=$PROJECT_ID --token=$TOKEN --only functions,database,firestore && break; done
79+
fi
6780
}
6881

6982
function run_tests {

0 commit comments

Comments
 (0)