@@ -19,11 +19,9 @@ The integration test framework:
19
19
```
20
20
This creates ` integration_test/firebase-functions-python-local.whl `
21
21
22
- 2 . ** Firebase Projects** : V1 and V2 tests run on separate Firebase projects:
23
- - ** V1 functions** : ` functions-integration-tests `
24
- - ** V2 functions** : ` functions-integration-tests-v2 `
25
-
26
- These projects are completely isolated from each other.
22
+ 2 . ** Firebase Project** : Python SDK only supports 2nd gen Cloud Functions:
23
+ - ** All tests** : ` functions-integration-tests-v2 `
24
+ - ** Note** : V1/V2 in suite names refers to Firebase service API versions, not Cloud Functions generations
27
25
28
26
3 . ** Dependencies** :
29
27
- Node.js 18+ (for test runner and generation scripts)
@@ -53,53 +51,31 @@ node scripts/generate.js --list
53
51
54
52
### 2. Deploy Functions
55
53
56
- ** For V1 Tests:**
57
- ``` bash
58
- npm run deploy:v1
59
- # OR manually:
60
- cd generated/functions
61
- firebase deploy --only functions --project functions-integration-tests
62
- ```
63
-
64
- ** For V2 Tests:**
65
54
``` bash
66
- npm run deploy:v2
55
+ npm run deploy
67
56
# OR manually:
68
57
cd generated/functions
69
58
firebase deploy --only functions --project functions-integration-tests-v2
70
59
```
71
60
72
61
### 3. Run Tests
73
62
74
- ** V1 Tests (uses functions-integration-tests project):**
75
63
``` bash
76
- # Run all V1 tests
77
- npm run test:v1: all
64
+ # Run all tests sequentially
65
+ npm run test:all
78
66
79
- # Run specific V1 test
80
- npm run test:v1: firestore
67
+ # Run specific test suite
68
+ npm run test:firestore
81
69
82
- # Run V1 tests in parallel
83
- npm run test:v1:all:parallel
84
- ```
85
-
86
- ** V2 Tests (uses functions-integration-tests-v2 project):**
87
- ``` bash
88
- # Run all V2 tests
89
- npm run test:v2:all
90
-
91
- # Run V2 tests in parallel
92
- npm run test:v2:all:parallel
70
+ # Run tests in parallel (faster but harder to debug)
71
+ npm run test:all:parallel
93
72
```
94
73
95
74
### 4. Cleanup
96
75
97
76
``` bash
98
- # Clean up V1 deployed functions
99
- npm run cleanup:v1
100
-
101
- # Clean up V2 deployed functions
102
- npm run cleanup:v2
77
+ # Clean up deployed functions
78
+ npm run cleanup
103
79
104
80
# Remove generated files
105
81
npm run clean
@@ -110,8 +86,7 @@ npm run clean
110
86
```
111
87
integration_test/
112
88
├── config/
113
- │ ├── v1/suites.yaml # V1 test suite configuration
114
- │ └── v2/suites.yaml # V2 test suite configuration
89
+ │ └── suites.yaml # Unified test suite configuration
115
90
├── templates/
116
91
│ └── functions/ # Python function templates
117
92
│ ├── firebase.json.hbs
@@ -133,11 +108,11 @@ integration_test/
133
108
134
109
## Configuration
135
110
136
- ### Suite Configuration (` config/v[1|2]/ suites.yaml ` )
111
+ ### Suite Configuration (` config/suites.yaml ` )
137
112
138
113
``` yaml
139
114
defaults :
140
- projectId : functions-integration-tests
115
+ projectId : functions-integration-tests-v2
141
116
region : us-central1
142
117
timeout : 540
143
118
dependencies :
@@ -201,7 +176,7 @@ To add support for a new trigger type:
201
176
}
202
177
}
203
178
` ` `
204
- 3. **Add Configuration** : Update `config/v1/ suites.yaml`
179
+ 3. **Add Configuration** : Update `config/suites.yaml`
205
180
4. **Add Tests** : Create Jest test file in `tests/v1/[service].test.ts`
206
181
207
182
# # Environment Variables
@@ -265,45 +240,33 @@ gsutil ls gs://functions-integration-tests-v2-test-results/
265
240
266
241
If functions aren't cleaned up properly :
267
242
` ` ` bash
268
- # For V1 project
269
- firebase functions:delete --project functions-integration-tests --force
243
+ # Delete functions
244
+ firebase functions:delete --project functions-integration-tests-v2 --force
270
245
271
- # For V2 project
246
+ # Or use cleanup script
272
247
firebase functions:delete --project functions-integration-tests-v2 --force
273
248
` ` `
274
249
275
250
# # Cloud Build Integration
276
251
277
- The integration tests are run via Cloud Build with complete project separation. V1 and V2 tests run on different Firebase projects to ensure isolation .
252
+ The integration tests are run via Cloud Build. Python SDK only supports 2nd gen functions, so all tests deploy to the same project .
278
253
279
- # ## Available Configurations
254
+ # ## Configuration
280
255
281
- # ### 1. `cloudbuild-v1.yaml` - V1 Tests Only
282
- - **Project**: `functions-integration-tests`
283
- - **What it does**:
284
- - Builds the Python SDK wheel
285
- - Generates all V1 Python functions
286
- - Deploys to V1 project
287
- - Runs all V1 integration tests
288
- - Cleans up deployed functions
289
-
290
- **Usage** (from repository root):
291
- ` ` ` bash
292
- gcloud builds submit --config=integration_test/cloudbuild-v1.yaml .
293
- ` ` `
294
-
295
- # ### 2. `cloudbuild-v2.yaml` - V2 Tests Only
256
+ # ### `cloudbuild.yaml`
296
257
- **Project**: `functions-integration-tests-v2`
297
258
- **What it does**:
298
259
- Builds the Python SDK wheel
299
- - Generates all V2 Python functions
300
- - Deploys to V2 project
301
- - Runs all V2 integration tests
260
+ - Generates Python functions (both v1 and v2 API suites)
261
+ - Deploys to functions-integration-tests-v2
262
+ - Runs integration tests
302
263
- Cleans up deployed functions
303
264
304
265
**Usage** (from repository root):
305
266
` ` ` bash
306
- gcloud builds submit --config=integration_test/cloudbuild-v2.yaml .
267
+ gcloud builds submit --config=integration_test/cloudbuild.yaml --project=functions-integration-tests-v2 .
268
+ # Or use npm script:
269
+ npm run cloudbuild
307
270
` ` `
308
271
309
272
# ## Configuration Details
@@ -342,44 +305,31 @@ Artifacts are uploaded to:
342
305
# ## Automated Triggers
343
306
344
307
You can set up Cloud Build triggers to run on :
345
- - **Pull requests**: Use `cloudbuild-v1 .yaml` for quick feedback
346
- - **Merges to main**: Run both `cloudbuild-v1.yaml` and `cloudbuild-v2 .yaml` separately
347
- - **Nightly builds**: Run both configurations for full regression testing
308
+ - **Pull requests**: Use `cloudbuild.yaml` for quick feedback on v1 API tests
309
+ - **Merges to main**: Run full test suite with `cloudbuild.yaml`
310
+ - **Nightly builds**: Run comprehensive tests across all suites
348
311
349
312
# ## Manual CI/CD Steps
350
313
351
- For custom CI/CD pipelines, run V1 and V2 tests separately :
314
+ For custom CI/CD pipelines :
352
315
353
- # ### V1 Tests
354
316
` ` ` bash
355
317
# Build SDK
356
318
./scripts/pack-for-integration-tests.sh
357
319
358
- # Generate, deploy, and test V1 functions
320
+ # Generate functions (v1 and/or v2 API suites)
359
321
cd integration_test
360
- node scripts/generate.js 'v1_*'
361
- cd generated/functions
362
- pip install -r requirements.txt
363
- firebase deploy --project functions-integration-tests --token $FIREBASE_TOKEN
364
- cd ../..
365
- npm run test:v1:all:sequential
366
- npm run cleanup:v1
367
- ` ` `
322
+ node scripts/generate.js 'v1_*' # Or 'v2_*' or specific suites
368
323
369
- # ### V2 Tests
370
- ` ` ` bash
371
- # Build SDK
372
- ./scripts/pack-for-integration-tests.sh
373
-
374
- # Generate, deploy, and test V2 functions
375
- cd integration_test
376
- node scripts/generate.js 'v2_*'
324
+ # Deploy and test
377
325
cd generated/functions
326
+ python3.11 -m venv venv
327
+ source venv/bin/activate
378
328
pip install -r requirements.txt
379
329
firebase deploy --project functions-integration-tests-v2 --token $FIREBASE_TOKEN
380
330
cd ../..
381
- npm run test:v2: all:sequential
382
- npm run cleanup:v2
331
+ npm run test:all:sequential
332
+ npm run cleanup
383
333
` ` `
384
334
385
335
# # Contributing
0 commit comments