44set -e
55
66function usage {
7- echo " Usage: $0 <project_id_node_6 > [<project_id_node_8 >]"
7+ echo " Usage: $0 <project_id_node_8 > [<project_id_node_10 >]"
88 exit 1
99}
1010
11- # This script takes 1 or 2 params , both of which are Firebase project ids.
12- # If there is only one given, that project will be used for both node6 and node8
13- # Otherwise, param1 will be used for node6
14- # and param2 will be used for node8
15- # The first parameter is required and is the Firebase project id .
11+ # This script takes 1 or 2 arguments , both of which are Firebase project ids.
12+ # If only one argument is given, that project will be used for both node 8 and node 10
13+ # Otherwise, first argument will be used for node 8 and second argument will be used
14+ # for node 10.
15+ # Note that at least one argument is required .
1616if [[ $1 == " " ]]; then
1717 usage
1818fi
1919if [[ $2 == " " ]]; then
20- PROJECT_ID_NODE_6=$1
2120 PROJECT_ID_NODE_8=$1
21+ PROJECT_ID_NODE_10=$1
2222else
23- PROJECT_ID_NODE_6 =$1
24- PROJECT_ID_NODE_8 =$2
23+ PROJECT_ID_NODE_8 =$1
24+ PROJECT_ID_NODE_10 =$2
2525fi
2626
2727# Directory where this script lives.
@@ -39,18 +39,18 @@ function build_sdk {
3939 mv firebase-functions-* .tgz integration_test/functions/firebase-functions.tgz
4040}
4141
42- function pick_node6 {
43- cd $DIR
44- PROJECT_ID=$PROJECT_ID_NODE_6
45- cp package.node6.json functions/package.json
46- }
47-
4842function pick_node8 {
4943 cd $DIR
5044 PROJECT_ID=$PROJECT_ID_NODE_8
5145 cp package.node8.json functions/package.json
5246}
5347
48+ function pick_node10 {
49+ cd $DIR
50+ PROJECT_ID=$PROJECT_ID_NODE_10
51+ cp package.node10.json functions/package.json
52+ }
53+
5454function install_deps {
5555 announce " Installing dependencies..."
5656 cd $DIR /functions
@@ -63,9 +63,9 @@ function delete_all_functions {
6363 cd $DIR
6464 # Try to delete, if there are errors it is because the project is already empty,
6565 # in that case do nothing.
66- firebase functions:delete callableTests createUserTests databaseTests deleteUserTests firestoreTests integrationTests pubsubTests remoteConfigTests --force --project=$PROJECT_ID_NODE_6 || : &
67- if ! [[ $PROJECT_ID_NODE_6 == $PROJECT_ID_NODE_8 ]]; then
68- firebase functions:delete callableTests createUserTests databaseTests deleteUserTests firestoreTests integrationTests pubsubTests remoteConfigTests --force --project=$PROJECT_ID_NODE_8 || : &
66+ firebase functions:delete callableTests createUserTests databaseTests deleteUserTests firestoreTests integrationTests pubsubTests remoteConfigTests --force --project=$PROJECT_ID_NODE_8 || : &
67+ if ! [[ $PROJECT_ID_NODE_8 == $PROJECT_ID_NODE_10 ]]; then
68+ firebase functions:delete callableTests createUserTests databaseTests deleteUserTests firestoreTests integrationTests pubsubTests remoteConfigTests --force --project=$PROJECT_ID_NODE_10 || : &
6969 fi
7070 wait
7171 announce " Project emptied."
@@ -96,14 +96,14 @@ function run_all_tests {
9696 if [[ $FIREBASE_FUNCTIONS_URL == " https://preprod-cloudfunctions.sandbox.googleapis.com" ]]; then
9797 TEST_DOMAIN=" txcloud.net"
9898 fi
99- TEST_URL_NODE_6=" https://us-central1-$PROJECT_ID_NODE_6 .$TEST_DOMAIN /integrationTests"
10099 TEST_URL_NODE_8=" https://us-central1-$PROJECT_ID_NODE_8 .$TEST_DOMAIN /integrationTests"
101- echo $TEST_URL_NODE_6
100+ TEST_URL_NODE_10= " https://us-central1- $PROJECT_ID_NODE_10 . $TEST_DOMAIN /integrationTests "
102101 echo $TEST_URL_NODE_8
103- curl --fail $TEST_URL_NODE_6 & NODE6PID= $!
102+ echo $TEST_URL_NODE_10
104103 curl --fail $TEST_URL_NODE_8 & NODE8PID=$!
105- wait $NODE6PID && echo ' node 6 passed ' || (announce ' Node 6 tests failed ' ; cleanup ; announce ' Tests failed ' ; exit 1)
104+ curl --fail $TEST_URL_NODE_10 & NODE10PID= $!
106105 wait $NODE8PID && echo ' node 8 passed' || (announce ' Node 8 tests failed' ; cleanup; announce ' Tests failed' ; exit 1)
106+ wait $NODE10PID && echo ' node 10 passed' || (announce ' Node 10 tests failed' ; cleanup; announce ' Tests failed' ; exit 1)
107107}
108108
109109function run_tests {
@@ -137,18 +137,19 @@ install_deps
137137delete_all_functions
138138announce " Deploying functions to Node 8 runtime ..."
139139deploy
140- if [[ $PROJECT_ID_NODE_6 == $PROJECT_ID_NODE_8 ]]; then
140+ if [[ $PROJECT_ID_NODE_8 == $PROJECT_ID_NODE_10 ]]; then
141141 waitForPropagation
142142 run_tests
143143fi
144- pick_node6
145- announce " Re-deploying the same functions to Node 6 runtime ..."
146- deploy
147- waitForPropagation
148- if [[ $PROJECT_ID_NODE_6 == $PROJECT_ID_NODE_8 ]]; then
149- run_tests
150- else
151- run_all_tests
152- fi
144+ # TODO(b/134418760): Uncomment this when Node 10 issues are fixed
145+ # pick_node10
146+ # announce "Re-deploying the same functions to Node 10 runtime ..."
147+ # deploy
148+ # waitForPropagation
149+ # if [[ $PROJECT_ID_NODE_8 == $PROJECT_ID_NODE_10 ]]; then
150+ # run_tests
151+ # else
152+ # run_all_tests
153+ # fi
153154cleanup
154155announce " All tests pass!"
0 commit comments