[go: nahoru, domu]

Skip to content

Commit

Permalink
update hosting integration test structure (firebase#2177)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkendall committed Apr 27, 2020
1 parent e915dcd commit a6ee068
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
node-version:
- 8.x
script:
- ./scripts/test-hosting.sh
- npm run test:hosting
- ./scripts/test-triggers-end-to-end.sh
- npm run test:client-integration
- npm run test:extensions-emulator
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"prepare": "npm run clean && npm run build -- --build tsconfig.publish.json",
"test": "npm run lint:quiet && npm run mocha",
"test:client-integration": "./scripts/client-integration-tests/run.sh",
"test:hosting": "./scripts/hosting-tests/run.sh",
"test:extensions-emulator": "./scripts/extensions-emulator-tests/run.sh"
},
"files": [
Expand Down
21 changes: 13 additions & 8 deletions scripts/test-hosting.sh → scripts/hosting-tests/run.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CWD="$(pwd)"

source $DIR/set-default-credentials.sh
source scripts/set-default-credentials.sh

TARGET_FILE="${COMMIT_SHA}-${CI_JOB_ID}.txt"

Expand All @@ -22,13 +21,8 @@ echo "Creating temp directory..."
TEMP_DIR="$(mktemp -d)"
echo "Created temp directory: ${TEMP_DIR}"

echo "Building and packaging firebase-tools..."
npm pack
FBT_PACKAGE="$(pwd)/$(ls *.tgz)"
echo "Built and packaged firebase-tools: ${FBT_PACKAGE}"

echo "Installing firebase-tools..."
npm install --global "${FBT_PACKAGE}"
npm link
echo "Installed firebase-tools: $(which firebase)"

echo "Initalizing temp directory..."
Expand Down Expand Up @@ -61,6 +55,17 @@ kill "$PID"
wait
echo "Tested local serve."

echo "Testing local hosting emulator..."
PORT=5000
firebase emulators:start --only hosting --project "${FBTOOLS_TARGET_PROJECT}" &
PID="$!"
sleep 5
VALUE="$(curl localhost:${PORT}/${TARGET_FILE})"
test "${DATE}" = "${VALUE}" || (echo "Expected ${VALUE} to equal ${DATE}." && false)
kill "$PID"
wait
echo "Tested local hosting emulator."

echo "Testing hosting deployment..."
firebase deploy --only hosting --project "${FBTOOLS_TARGET_PROJECT}"
sleep 5
Expand Down

0 comments on commit a6ee068

Please sign in to comment.