Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f07952b
fix(firestore): increased retry limit to 40 reties
dackers86 Oct 7, 2025
a18ddfa
fix(database): updated broken database reference
dackers86 Oct 7, 2025
08c19bf
fix(pubsub): added default crednetials check for pubsub service account
dackers86 Oct 7, 2025
5d159f7
fix(storage): reduced v2 function length
dackers86 Oct 7, 2025
1497aa8
fix(schedular): updated schular to the correct function naming
dackers86 Oct 7, 2025
4091d60
chore(testlab): re-enabled skipped tests
dackers86 Oct 7, 2025
c0fc076
fix(*): updated storage collection names
dackers86 Oct 7, 2025
023ddb9
feat(*): updated firebase-admin to the latets version
dackers86 Oct 7, 2025
842b6c6
fix(*): Updated v1 and v2 tests to run simultaneously without error. …
dackers86 Oct 15, 2025
f030db1
chore(*): Extract exponential backoff logic
dackers86 Oct 15, 2025
9ec5803
fix(): increased timeoutm and tasks to run v1 and v2. Updated testing…
dackers86 Oct 21, 2025
9b8f76f
Merge remote-tracking branch 'origin/@invertase/integration-test-suit…
dackers86 Oct 21, 2025
b81dc12
fix(*): updated depenendecies
dackers86 Oct 21, 2025
d180941
fix(*): updated ts config to fix import error
dackers86 Oct 21, 2025
a8fc3a2
fix(*): import and formatting updates
dackers86 Oct 21, 2025
97bc24f
test(*): skip broken tests
dackers86 Oct 21, 2025
a49f91c
fix(*): updated testing framwork config types
dackers86 Oct 21, 2025
a5076d7
fix(*): update all express imports to use default imports for Node.js…
dackers86 Oct 21, 2025
0e4d480
fix(*): update js-yaml import to use default import for Node.js 22 co…
dackers86 Oct 21, 2025
c48bd46
fix(*): updated test imports
dackers86 Oct 21, 2025
6156e05
test(*): basic cloud build test
dackers86 Oct 21, 2025
6953e6b
test(*): Run basic deployment test
dackers86 Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/postmerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:

- name: "Run integration test"
run: npm run test:postmerge
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}

- name: Print debug logs
if: failure()
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ jobs:
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run test:bin
cloud-build-integration:
needs: "unit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: google-github-actions/auth@v2
with:
credentials_json: "${{ secrets.CF3_INTEGRATION_TEST_GOOGLE_CREDENTIALS }}"
create_credentials_file: true
- name: "Run Cloud Build Integration Tests"
run: |
cd integration_test
PROJECT_ID=cf3-integration-tests-v2-qa gcloud builds submit --config=cloudbuild-all.yaml --project=cf3-integration-tests-v2-qa
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
4 changes: 2 additions & 2 deletions integration_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Auth tests use Firebase client SDK configuration that is hardcoded in `tests/fir

The configuration is automatically used by auth tests and no additional setup is required.

### Auth Blocking Functions Limitation
### Auth Blocking Functions Configuration

Firebase has a limitation where **only ONE blocking auth function can be deployed per project at any time**. This means:

Expand Down Expand Up @@ -176,7 +176,7 @@ These tests remain in the codebase but are marked with `describe.skip()` until t

## Architecture

```
```text
integration_test/
├── config/
│ ├── v1/
Expand Down
64 changes: 64 additions & 0 deletions integration_test/cloudbuild-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Cloud Build configuration for Firebase Functions All Integration Tests
# Runs all test suites (both V1 and V2) sequentially

options:
machineType: "E2_HIGHCPU_8"
logging: CLOUD_LOGGING_ONLY

timeout: "7200s"

steps:
# Build SDK and run all test suites sequentially
# Using the official Google Cloud SDK image which includes gcloud pre-installed
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:stable"
id: "build-sdk-and-test-all"
entrypoint: "bash"
args:
- "-c"
- |
# Install Node.js 20.x
echo "Installing Node.js 20..."
apt-get update -qq
apt-get install -y -qq curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y -qq nodejs
node --version
npm --version

# Step 1: Build and pack the firebase-functions SDK from source
echo "Building firebase-functions SDK from source..."
pwd
ls -la
npm ci
npm run build
npm pack
# Move the tarball to where integration tests expect it
mv firebase-functions-*.tgz integration_test/firebase-functions-local.tgz
echo "SDK built and packed successfully"

# Step 2: Run all integration tests with the local SDK
cd integration_test
echo "Installing test dependencies..."
npm ci
# Install firebase-tools globally
npm install -g firebase-tools
# gcloud is already available in this image
gcloud config set project "$PROJECT_ID"
# Verify tools are installed
firebase --version
gcloud --version
# Verify gcloud project is set correctly
gcloud config get-value project
# Set environment variables
export PROJECT_ID="$PROJECT_ID"
echo "Running all tests on project: $PROJECT_ID"
# Use Application Default Credentials (Cloud Build service account)
# Run all test suites sequentially
node scripts/run-tests.js --sequential --skip-cleanup

# Artifacts to store
artifacts:
objects:
location: "gs://${PROJECT_ID}_cloudbuild/artifacts/${BUILD_ID}"
paths:
- "logs/**/*.log"
32 changes: 8 additions & 24 deletions integration_test/cloudbuild-v1.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
# Cloud Build configuration for Firebase Functions V1 Integration Tests
# Runs all V1 test suites sequentially to avoid rate limits
# Runs V1 test suites only

options:
machineType: "E2_HIGHCPU_8"
logging: CLOUD_LOGGING_ONLY

timeout: "3600s"
timeout: "7200s"

steps:
# Create storage bucket for test results if it doesn't exist
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:stable"
id: "create-bucket"
entrypoint: "bash"
args:
- "-c"
- |
# Create bucket for test results if it doesn't exist
BUCKET_NAME="gs://functions-integration-tests-test-results"
echo "Checking if bucket $$BUCKET_NAME exists..."
if ! gsutil ls "$$BUCKET_NAME" &>/dev/null; then
echo "Creating bucket $$BUCKET_NAME..."
gsutil mb -p "functions-integration-tests" "$$BUCKET_NAME"
else
echo "Bucket $$BUCKET_NAME already exists"
fi

# Build SDK and run all V1 test suites sequentially
- name: "node:20"
id: "build-sdk-and-test-v1"
Expand All @@ -51,15 +34,16 @@ steps:
# Verify tools are installed
firebase --version
gcloud --version
# V1 tests use functions-integration-tests project
echo "Running V1 tests on project: functions-integration-tests"
# Set environment variables
export PROJECT_ID="$PROJECT_ID"
echo "Running all tests on project: $PROJECT_ID"
# Use Application Default Credentials (Cloud Build service account)
# Run all V1 test suites sequentially
node scripts/run-tests.js --sequential --filter=v1 --use-published-sdk=file:firebase-functions-local.tgz
# Run V1 test suites only
node scripts/run-tests.js --sequential 'v1_*' --skip-cleanup

# Artifacts to store
artifacts:
objects:
location: "gs://functions-integration-tests-test-results/${BUILD_ID}"
location: "gs://${PROJECT_ID}_cloudbuild/artifacts/${BUILD_ID}"
paths:
- "logs/**/*.log"
34 changes: 9 additions & 25 deletions integration_test/cloudbuild-v2.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
# Cloud Build configuration for Firebase Functions V2 Integration Tests
# Runs all V2 test suites sequentially to avoid rate limits
# Runs V2 test suites only

options:
machineType: "E2_HIGHCPU_8"
logging: CLOUD_LOGGING_ONLY

timeout: "3600s"
timeout: "7200s"

steps:
# Create storage bucket for test results if it doesn't exist
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:stable"
id: "create-bucket"
entrypoint: "bash"
args:
- "-c"
- |
# Create bucket for test results if it doesn't exist
BUCKET_NAME="gs://functions-integration-tests-v2-test-results"
echo "Checking if bucket $$BUCKET_NAME exists..."
if ! gsutil ls "$$BUCKET_NAME" &>/dev/null; then
echo "Creating bucket $$BUCKET_NAME..."
gsutil mb -p "functions-integration-tests-v2" "$$BUCKET_NAME"
else
echo "Bucket $$BUCKET_NAME already exists"
fi

# Build SDK and run all V2 test suites sequentially
# Using the official Google Cloud SDK image which includes gcloud pre-installed
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:stable"
Expand Down Expand Up @@ -60,21 +43,22 @@ steps:
# Install firebase-tools globally
npm install -g firebase-tools
# gcloud is already available in this image
gcloud config set project functions-integration-tests-v2
gcloud config set project "$PROJECT_ID"
# Verify tools are installed
firebase --version
gcloud --version
# Verify gcloud project is set correctly
gcloud config get-value project
# V2 tests use functions-integration-tests-v2 project
echo "Running V2 tests on project: functions-integration-tests-v2"
# Set environment variables
export PROJECT_ID="$PROJECT_ID"
echo "Running all tests on project: $PROJECT_ID"
# Use Application Default Credentials (Cloud Build service account)
# Run all V2 test suites sequentially
node scripts/run-tests.js --sequential --filter=v2 --use-published-sdk=file:firebase-functions-local.tgz
# Run V2 test suites only
node scripts/run-tests.js --sequential 'v2_*' --skip-cleanup

# Artifacts to store
artifacts:
objects:
location: "gs://functions-integration-tests-v2-test-results/${BUILD_ID}"
location: "gs://${PROJECT_ID}_cloudbuild/artifacts/${BUILD_ID}"
paths:
- "logs/**/*.log"
16 changes: 5 additions & 11 deletions integration_test/config/v1/suites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Common values are defined in the defaults section to reduce duplication

defaults:
projectId: functions-integration-tests
projectId: ${PROJECT_ID:-functions-integration-tests}
region: us-central1
timeout: 540
dependencies:
Expand Down Expand Up @@ -78,22 +78,16 @@ suites:
- name: storageOnMetadataUpdateTests
trigger: onMetadataUpdate

# Auth triggers (all non-blocking functions)
# Auth triggers (non-blocking functions only - blocking functions must be run separately)
- name: v1_auth
description: "V1 Auth trigger tests"
description: "V1 Auth trigger tests (non-blocking only)"
version: v1
service: auth
functions:
- name: authUserOnCreateTests
trigger: onCreate
- name: authUserOnDeleteTests
trigger: onDelete
- name: authUserBeforeCreateTests
trigger: beforeCreate
collection: authBeforeCreateTests
- name: authUserBeforeSignInTests
trigger: beforeSignIn
collection: authBeforeSignInTests

# Auth non-blocking only (for parallel execution)
- name: v1_auth_nonblocking
Expand All @@ -115,7 +109,7 @@ suites:
# - name: authUserBeforeCreateTests
# trigger: beforeCreate
# collection: authBeforeCreateTests
# blocking: true
# timeout: 10 # Short timeout for blocking function (Firebase enforces 7s max)

# Auth beforeSignIn blocking function (must run separately)
# - name: v1_auth_before_signin
Expand All @@ -126,7 +120,7 @@ suites:
# - name: authUserBeforeSignInTests
# trigger: beforeSignIn
# collection: authBeforeSignInTests
# blocking: true
# timeout: 10 # Short timeout for blocking function (Firebase enforces 7s max)

# Cloud Tasks triggers
# - name: v1_tasks
Expand Down
25 changes: 16 additions & 9 deletions integration_test/config/v2/suites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Common values are defined in the defaults section to reduce duplication

defaults:
projectId: functions-integration-tests-v2
projectId: ${PROJECT_ID:-functions-integration-tests-v2}
region: us-central1
timeout: 540
dependencies:
Expand All @@ -19,18 +19,22 @@ suites:
version: v2
service: firestore
functions:
- name: firestoreOnDocumentCreatedTests
- name: v2FirestoreOnDocumentCreatedTests
trigger: onDocumentCreated
document: "tests/{testId}"
- name: firestoreOnDocumentDeletedTests
document: "v2tests/{testId}"
collection: "v2FirestoreOnDocumentCreatedTests"
- name: v2FirestoreOnDocumentDeletedTests
trigger: onDocumentDeleted
document: "tests/{testId}"
- name: firestoreOnDocumentUpdatedTests
document: "v2tests/{testId}"
collection: "v2FirestoreOnDocumentDeletedTests"
- name: v2FirestoreOnDocumentUpdatedTests
trigger: onDocumentUpdated
document: "tests/{testId}"
- name: firestoreOnDocumentWrittenTests
document: "v2tests/{testId}"
collection: "v2FirestoreOnDocumentUpdatedTests"
- name: v2FirestoreOnDocumentWrittenTests
trigger: onDocumentWritten
document: "tests/{testId}"
document: "v2tests/{testId}"
collection: "v2FirestoreOnDocumentWrittenTests"

# Realtime Database triggers
- name: v2_database
Expand Down Expand Up @@ -69,10 +73,13 @@ suites:
functions:
- name: storageOnObjectFinalizedTests
trigger: onObjectFinalized
collection: storageFinalizedTests
- name: storageOnObjectDeletedTests
trigger: onObjectDeleted
collection: storageDeletedTests
- name: storageOnObjectMetadataUpdatedTests
trigger: onObjectMetadataUpdated
collection: storageMetadataTests

# Cloud Tasks triggers
- name: v2_tasks
Expand Down
4 changes: 2 additions & 2 deletions integration_test/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const config = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/tests/**/*.test.ts"],
testTimeout: 120_000,
testTimeout: 180_000, // Increased to 3 minutes for auth blocking functions
transform: {
"^.+\\.(t|j)s$": ["ts-jest", { tsconfig: "tsconfig.test.json" }],
},
};

export default config;
export default config;
Loading
Loading