Skip to content

Commit

Permalink
Use ADC for Emulator Tests (#1575)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Jul 31, 2019
1 parent 0c6ead5 commit cc43f90
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- TEST_NAME="Emulator End-to-End Tests"
before_script:
- echo "==== ${TEST_NAME} ===="
- ./scripts/decrypt-app-credentials.sh
script:
- ./scripts/test-triggers-end-to-end.sh
after_script: skip
Expand Down
18 changes: 18 additions & 0 deletions scripts/set-default-credentials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e

CWD="$(pwd)"

if [ "${TRAVIS}" != "true" ]; then
export TRAVIS_COMMIT="localtesting"
export TRAVIS_JOB_ID="$(echo $RANDOM)"
export TRAVIS_REPO_SLUG="firebase/firebase-tools"
fi

GOOGLE_APPLICATION_CREDENTIALS="${CWD}/scripts/creds-private.json"
if [ "${TRAVIS_REPO_SLUG}" == "firebase/firebase-tools" ]; then
GOOGLE_APPLICATION_CREDENTIALS="${CWD}/scripts/creds-public.json"
fi
export GOOGLE_APPLICATION_CREDENTIALS

echo "Application Default Credentials: ${GOOGLE_APPLICATION_CREDENTIALS}"
15 changes: 3 additions & 12 deletions scripts/test-hosting.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CWD="$(pwd)"

if [ "${TRAVIS}" != "true" ]; then
TRAVIS_COMMIT="localtesting"
TRAVIS_JOB_ID="$(echo $RANDOM)"
TRAVIS_REPO_SLUG="firebase/firebase-tools"
fi
source $DIR/set-default-credentials.sh

CWD="$(pwd)"
TARGET_FILE="${TRAVIS_COMMIT}-${TRAVIS_JOB_ID}.txt"

GOOGLE_APPLICATION_CREDENTIALS="${CWD}/scripts/creds-private.json"
if [ "${TRAVIS_REPO_SLUG}" == "firebase/firebase-tools" ]; then
GOOGLE_APPLICATION_CREDENTIALS="${CWD}/scripts/creds-public.json"
fi
export GOOGLE_APPLICATION_CREDENTIALS

echo "Running in ${CWD}"
echo "Running with node: $(which node)"
echo "Running with npm: $(which npm)"
Expand Down
4 changes: 3 additions & 1 deletion scripts/test-triggers-end-to-end.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

set -xe
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source $DIR/set-default-credentials.sh

FIREBASE_CLI="./lib/bin/firebase.js"

Expand Down

0 comments on commit cc43f90

Please sign in to comment.