Skip to content

Commit ab3260b

Browse files
committed
refactor(integration_tests): move to a node script
1 parent 123686d commit ab3260b

File tree

11 files changed

+1575
-341
lines changed

11 files changed

+1575
-341
lines changed

integration_test_declarative/cloudbuild.yaml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Simplified Cloud Build configuration for Firebase Functions Integration Tests
2-
# Runs all test suites sequentially to avoid rate limits
1+
# Cloud Build configuration for Firebase Functions Integration Tests
2+
# Runs all enabled test suites sequentially to avoid rate limits
33

44
options:
55
machineType: 'E2_HIGHCPU_8'
@@ -12,24 +12,39 @@ substitutions:
1212
_REGION: 'us-central1'
1313

1414
steps:
15-
# Single step: Run all v1 test suites sequentially and cleanup
15+
# Build SDK and run all enabled test suites sequentially
1616
- name: 'node:18'
17-
id: 'test-v1-all'
17+
id: 'build-sdk-and-test'
1818
entrypoint: 'bash'
1919
args:
2020
- '-c'
2121
- |
22-
# Install dependencies
22+
# Step 1: Build and pack the firebase-functions SDK from source
23+
echo "Building firebase-functions SDK from source..."
24+
npm ci
25+
npm run build
26+
npm pack
27+
# Move the tarball to where integration tests expect it
28+
mv firebase-functions-*.tgz integration_test_declarative/firebase-functions-local.tgz
29+
echo "SDK built and packed successfully"
30+
31+
# Step 2: Run integration tests with the local SDK
32+
cd integration_test_declarative
33+
echo "Installing test dependencies..."
2334
npm ci
2435
# Install firebase-tools globally
2536
npm install -g firebase-tools
2637
# Verify firebase is installed
2738
firebase --version
2839
# Use Application Default Credentials (Cloud Build service account)
29-
export PROJECT_ID=${_PROJECT_ID}
30-
export REGION=${_REGION}
31-
# Run all v1 tests sequentially (includes cleanup between suites)
32-
npm run test:v1:all
40+
# Don't set PROJECT_ID or REGION - let each suite use values defined in its YAML config
41+
# Some suites use functions-integration-tests, others use functions-integration-tests-v2
42+
# All suites currently use us-central1, but this keeps YAML as single source of truth
43+
# Run all enabled tests sequentially (reads from YAML configs)
44+
# This will run all suites defined in config/v1/suites.yaml and config/v2/suites.yaml
45+
# Commented out suites in YAML will be automatically skipped
46+
# The tests will automatically use the firebase-functions-local.tgz we just created
47+
npm run test:all:sequential
3348
3449
# Artifacts to store
3550
artifacts:

integration_test_declarative/package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
"scripts": {
77
"generate": "node scripts/generate.js",
88
"test": "jest --forceExit",
9+
"run-tests": "node scripts/run-tests.js",
910
"run-suite": "./scripts/run-suite.sh",
10-
"test:firestore": "./scripts/run-suite.sh v1_firestore",
11-
"test:v1": "./scripts/run-suite.sh v1_firestore v1_database v1_pubsub v1_storage v1_tasks v1_remoteconfig v1_testlab v1_auth_nonblocking",
12-
"test:v1:all": "./scripts/run-sequential.sh",
13-
"test:v1:all:parallel": "node scripts/generate.js v1_firestore v1_database v1_pubsub v1_storage v1_tasks v1_remoteconfig v1_testlab v1_auth_nonblocking && ./scripts/run-suite.sh v1_firestore v1_database v1_pubsub v1_storage v1_tasks v1_remoteconfig v1_testlab v1_auth_nonblocking",
14-
"test:v1:all:save": "npm run test:v1:all 2>&1 | tee test-output-$(date +%Y%m%d-%H%M%S).log",
15-
"test:v1:auth-before-create": "node scripts/generate.js v1_auth_before_create && ./scripts/run-suite.sh v1_auth_before_create",
16-
"test:v1:auth-before-signin": "node scripts/generate.js v1_auth_before_signin && ./scripts/run-suite.sh v1_auth_before_signin",
11+
"test:firestore": "node scripts/run-tests.js v1_firestore",
12+
"test:v1": "node scripts/run-tests.js v1_firestore v1_database v1_pubsub v1_storage v1_tasks v1_remoteconfig v1_testlab v1_auth_nonblocking",
13+
"test:v1:all": "node scripts/run-tests.js --sequential 'v1_*'",
14+
"test:v1:all:parallel": "node scripts/run-tests.js 'v1_*'",
15+
"test:v2:all": "node scripts/run-tests.js --sequential 'v2_*'",
16+
"test:v2:all:parallel": "node scripts/run-tests.js 'v2_*'",
17+
"test:all:sequential": "node scripts/run-tests.js --sequential",
18+
"test:v1:auth-before-create": "node scripts/run-tests.js v1_auth_before_create",
19+
"test:v1:auth-before-signin": "node scripts/run-tests.js v1_auth_before_signin",
1720
"cleanup": "./scripts/cleanup-suite.sh",
1821
"cleanup:list": "./scripts/cleanup-suite.sh --list-artifacts",
1922
"clean": "rm -rf generated/*",

0 commit comments

Comments
 (0)