Skip to content

Commit c83c039

Browse files
committed
feat(integration_test): migrate v2 tests
1 parent 26c8cbd commit c83c039

34 files changed

+2152
-26
lines changed

integration_test_declarative/PLAN.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ Each service needs:
2020
- Test file in `tests/v2/`
2121

2222
Services to migrate:
23-
- [ ] **Firestore V2** - Document triggers with namespaces
24-
- [ ] **Database V2** - Realtime database with new API
25-
- [ ] **PubSub V2** - Topic and message handling
26-
- [ ] **Storage V2** - Object lifecycle events
27-
- [ ] **Tasks V2** - Task queue with new options
28-
- [ ] **Scheduler V2** - Cron jobs with timezone support
29-
- [ ] **RemoteConfig V2** - Configuration updates
30-
- [ ] **TestLab V2** - Test matrix completion
31-
- [ ] **Identity V2** - Replaces Auth with beforeUserCreated/beforeUserSignedIn
32-
- [ ] **EventArc V2** - Custom event handling
33-
- [ ] **Alerts V2** - Firebase Alerts integration (if needed)
23+
- [x] **Firestore V2** - Document triggers with namespaces
24+
- [x] **Database V2** - Realtime database with new API
25+
- [x] **PubSub V2** - Topic and message handling
26+
- [x] **Storage V2** - Object lifecycle events
27+
- [x] **Tasks V2** - Task queue with new options
28+
- [x] **Scheduler V2** - Cron jobs with timezone support
29+
- [x] **RemoteConfig V2** - Configuration updates
30+
- [x] **TestLab V2** - Test matrix completion
31+
- [x] **Identity V2** - Replaces Auth with beforeUserCreated/beforeUserSignedIn
32+
- [x] **EventArc V2** - Custom event handling
33+
- [x] **Alerts V2** - Firebase Alerts integration (if needed)
3434

3535
### 1.2 Project Setup Strategy
3636

@@ -88,25 +88,11 @@ options:
8888
### 2.2 CI Orchestration Script (`scripts/run-ci-tests.sh`)
8989

9090
Features needed:
91-
- Parallel execution of non-conflicting test suites
92-
- Sequential execution of blocking functions
91+
- Sequential execution of test suites
9392
- Proper error handling and aggregation
9493
- Test result artifact storage
9594
- Comprehensive cleanup on success or failure
9695

97-
#### Execution Strategy
98-
99-
**Parallel Groups** (can run simultaneously):
100-
- Group 1: Firestore, Database, Storage, RemoteConfig, TestLab
101-
- Group 2: PubSub, Scheduler, Tasks, EventArc
102-
- Group 3: Non-blocking Auth/Identity functions
103-
104-
**Sequential Tests** (must run alone):
105-
- V1 auth.beforeCreate
106-
- V1 auth.beforeSignIn
107-
- V2 identity.beforeUserCreated
108-
- V2 identity.beforeUserSignedIn
109-
11096
## Phase 3: Documentation
11197

11298
### 3.1 Project Setup Guide (`docs/PROJECT_SETUP.md`)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
suite:
2+
name: v2_alerts
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Alerts trigger tests (deployment only)"
6+
version: v2
7+
service: alerts
8+
9+
functions:
10+
# Generic alert
11+
- name: alertsOnAlertPublishedTests
12+
trigger: onAlertPublished
13+
alertType: "crashlytics.newFatalIssue"
14+
timeout: 540
15+
16+
# App Distribution alerts
17+
- name: alertsOnInAppFeedbackPublishedTests
18+
trigger: onInAppFeedbackPublished
19+
timeout: 540
20+
21+
- name: alertsOnNewTesterIosDevicePublishedTests
22+
trigger: onNewTesterIosDevicePublished
23+
timeout: 540
24+
25+
# Billing alerts
26+
- name: alertsOnPlanAutomatedUpdatePublishedTests
27+
trigger: onPlanAutomatedUpdatePublished
28+
timeout: 540
29+
30+
- name: alertsOnPlanUpdatePublishedTests
31+
trigger: onPlanUpdatePublished
32+
timeout: 540
33+
34+
# Crashlytics alerts
35+
- name: alertsOnNewAnrIssuePublishedTests
36+
trigger: onNewAnrIssuePublished
37+
timeout: 540
38+
39+
- name: alertsOnNewFatalIssuePublishedTests
40+
trigger: onNewFatalIssuePublished
41+
timeout: 540
42+
43+
- name: alertsOnNewNonFatalIssuePublishedTests
44+
trigger: onNewNonfatalIssuePublished
45+
timeout: 540
46+
47+
- name: alertsOnRegressionAlertPublishedTests
48+
trigger: onRegressionAlertPublished
49+
timeout: 540
50+
51+
- name: alertsOnStabilityDigestPublishedTests
52+
trigger: onStabilityDigestPublished
53+
timeout: 540
54+
55+
- name: alertsOnVelocityAlertPublishedTests
56+
trigger: onVelocityAlertPublished
57+
timeout: 540
58+
59+
# Performance alerts
60+
- name: alertsOnThresholdAlertPublishedTests
61+
trigger: onThresholdAlertPublished
62+
timeout: 540
63+
64+
dependencies:
65+
firebase-admin: "^12.0.0"
66+
firebase-functions: "{{sdkTarball}}"
67+
68+
devDependencies:
69+
typescript: "^4.9.5"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
suite:
2+
name: v2_database
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Realtime Database trigger tests"
6+
version: v2
7+
service: database
8+
9+
functions:
10+
- name: databaseCreatedTests
11+
trigger: onValueCreated
12+
path: "databaseCreatedTests/{testId}/start"
13+
timeout: 540
14+
collection: databaseCreatedTests
15+
16+
- name: databaseDeletedTests
17+
trigger: onValueDeleted
18+
path: "databaseDeletedTests/{testId}/start"
19+
timeout: 540
20+
collection: databaseDeletedTests
21+
22+
- name: databaseUpdatedTests
23+
trigger: onValueUpdated
24+
path: "databaseUpdatedTests/{testId}/start"
25+
timeout: 540
26+
collection: databaseUpdatedTests
27+
28+
- name: databaseWrittenTests
29+
trigger: onValueWritten
30+
path: "databaseWrittenTests/{testId}/start"
31+
timeout: 540
32+
collection: databaseWrittenTests
33+
34+
dependencies:
35+
firebase-admin: "^12.0.0"
36+
firebase-functions: "{{sdkTarball}}"
37+
38+
devDependencies:
39+
typescript: "^4.9.5"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
suite:
2+
name: v2_eventarc
3+
projectId: functions-integration-tests-v2
4+
region: us-central1
5+
description: "V2 Eventarc trigger tests"
6+
version: v2
7+
service: eventarc
8+
9+
functions:
10+
- name: eventarcOnCustomEventPublishedTests
11+
eventType: achieved-leaderboard
12+
collection: eventarcOnCustomEventPublishedTests
13+
timeout: 540
14+
15+
dependencies:
16+
firebase-admin: "^12.0.0"
17+
firebase-functions: "{{sdkTarball}}"
18+
19+
devDependencies:
20+
typescript: "^4.9.5"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
suite:
2+
name: v2_firestore
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Firestore trigger tests"
6+
version: v2
7+
service: firestore
8+
9+
functions:
10+
- name: firestoreOnDocumentCreatedTests
11+
trigger: onDocumentCreated
12+
document: "tests/{testId}"
13+
timeout: 540
14+
collection: firestoreOnDocumentCreatedTests
15+
16+
- name: firestoreOnDocumentDeletedTests
17+
trigger: onDocumentDeleted
18+
document: "tests/{testId}"
19+
timeout: 540
20+
collection: firestoreOnDocumentDeletedTests
21+
22+
- name: firestoreOnDocumentUpdatedTests
23+
trigger: onDocumentUpdated
24+
document: "tests/{testId}"
25+
timeout: 540
26+
collection: firestoreOnDocumentUpdatedTests
27+
28+
- name: firestoreOnDocumentWrittenTests
29+
trigger: onDocumentWritten
30+
document: "tests/{testId}"
31+
timeout: 540
32+
collection: firestoreOnDocumentWrittenTests
33+
34+
dependencies:
35+
firebase-admin: "^12.0.0"
36+
firebase-functions: "{{sdkTarball}}"
37+
38+
devDependencies:
39+
typescript: "^4.9.5"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
suite:
2+
name: v2_identity
3+
projectId: functions-integration-tests-v2
4+
region: us-central1
5+
description: "V2 Identity trigger tests"
6+
version: v2
7+
service: identity
8+
9+
functions:
10+
- name: identityBeforeUserCreatedTests
11+
type: beforeUserCreated
12+
collection: identityBeforeUserCreatedTests
13+
timeout: 540
14+
15+
- name: identityBeforeUserSignedInTests
16+
type: beforeUserSignedIn
17+
collection: identityBeforeUserSignedInTests
18+
timeout: 540
19+
20+
dependencies:
21+
firebase-admin: "^12.0.0"
22+
firebase-functions: "{{sdkTarball}}"
23+
24+
devDependencies:
25+
typescript: "^4.9.5"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
suite:
2+
name: v2_pubsub
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Pub/Sub trigger tests"
6+
version: v2
7+
service: pubsub
8+
9+
functions:
10+
- name: pubsubOnMessagePublishedTests
11+
trigger: onMessagePublished
12+
topic: "custom_message_tests"
13+
timeout: 540
14+
collection: pubsubOnMessagePublishedTests
15+
16+
dependencies:
17+
firebase-admin: "^12.0.0"
18+
firebase-functions: "{{sdkTarball}}"
19+
20+
devDependencies:
21+
typescript: "^4.9.5"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
suite:
2+
name: v2_remoteconfig
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Remote Config trigger tests"
6+
version: v2
7+
service: remoteconfig
8+
9+
functions:
10+
- name: remoteConfigOnConfigUpdatedTests
11+
trigger: onConfigUpdated
12+
timeout: 540
13+
collection: remoteConfigOnConfigUpdatedTests
14+
15+
dependencies:
16+
firebase-admin: "^12.0.0"
17+
firebase-functions: "{{sdkTarball}}"
18+
19+
devDependencies:
20+
typescript: "^4.9.5"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
suite:
2+
name: v2_scheduler
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Scheduler trigger tests"
6+
version: v2
7+
service: scheduler
8+
9+
functions:
10+
- name: schedule
11+
trigger: onSchedule
12+
schedule: "every 10 hours"
13+
timeout: 540
14+
collection: schedulerOnScheduleV2Tests
15+
16+
dependencies:
17+
firebase-admin: "^12.0.0"
18+
firebase-functions: "{{sdkTarball}}"
19+
20+
devDependencies:
21+
typescript: "^4.9.5"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
suite:
2+
name: v2_storage
3+
projectId: functions-integration-tests
4+
region: us-central1
5+
description: "V2 Storage trigger tests"
6+
version: v2
7+
service: storage
8+
9+
functions:
10+
- name: storageOnObjectFinalizedTests
11+
trigger: onObjectFinalized
12+
timeout: 540
13+
collection: storageOnObjectFinalizedTests
14+
15+
- name: storageOnObjectDeletedTests
16+
trigger: onObjectDeleted
17+
timeout: 540
18+
collection: storageOnObjectDeletedTests
19+
20+
- name: storageOnObjectMetadataUpdatedTests
21+
trigger: onObjectMetadataUpdated
22+
timeout: 540
23+
collection: storageOnObjectMetadataUpdatedTests
24+
25+
dependencies:
26+
firebase-admin: "^12.0.0"
27+
firebase-functions: "{{sdkTarball}}"
28+
29+
devDependencies:
30+
typescript: "^4.9.5"

0 commit comments

Comments
 (0)