Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
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
28 changes: 6 additions & 22 deletions integration_test/cloudbuild-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@ options:
timeout: "3600s"

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 all test suites sequentially
node scripts/run-tests.js --sequential --skip-cleanup

# Artifacts to store
artifacts:
objects:
location: "gs://functions-integration-tests-test-results/${BUILD_ID}"
location: "gs://${PROJECT_ID}-artifacts/${BUILD_ID}"
paths:
- "logs/**/*.log"
30 changes: 7 additions & 23 deletions integration_test/cloudbuild-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,6 @@ options:
timeout: "3600s"

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 all test suites sequentially
node scripts/run-tests.js --sequential --skip-cleanup

# Artifacts to store
artifacts:
objects:
location: "gs://functions-integration-tests-v2-test-results/${BUILD_ID}"
location: "gs://${PROJECT_ID}-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