Skip to content

Commit 6ddd5e0

Browse files
kirstywilliamsexaby73
authored andcommitted
refactor(int): integration tests rewrite - wip
1 parent 9c81871 commit 6ddd5e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+11699
-617
lines changed

integration_test/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
REGION=us-central1
2+
PROJECT_ID=
3+
DATABASE_URL=
4+
STORAGE_BUCKET=
5+
NODE_VERSION=18
6+
FIREBASE_ADMIN=^10.0.0
7+
GOOGLE_APPLICATION_CREDENTIALS=

integration_test/.gitignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
firebase-debug.log*
8+
firebase-debug.*.log*
9+
10+
# Firebase cache
11+
.firebase/
12+
13+
# Firebase config
14+
15+
# Uncomment this if you'd like others to create their own Firebase project.
16+
# For a team working on the same Firebase project(s), it is recommended to leave
17+
# it commented so all members can deploy to the same project(s) in .firebaserc.
18+
# .firebaserc
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (http://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
68+
# Firebase/GCP config
69+
.firebaserc
70+
serviceAccount.json

integration_test/README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
1-
## How to Use
1+
# Integration Test Suite
22

3-
**_ATTENTION_**: Running this test will wipe the contents of the Firebase project(s) you run it against. Make sure you use disposable Firebase project(s)!
3+
## How to use
44

5-
Run the integration test as follows:
5+
### Prerequisites
66

7-
```bash
8-
./run_tests.sh <project_id> [<project_id2>]
9-
```
7+
Tests use locally installed firebase to invoke commands for deploying function.
8+
The test also requires that you have gcloud CLI installed and authenticated
9+
(`gcloud auth login`).
10+
11+
Tests are deployed with a unique identifier, which enables the teardown of its own resources, without affecting other test runs.
1012

11-
Test runs cycles of testing, once for Node.js 14 and another for Node.js 16.
13+
1. Add a service account at root serviceAccount.json
14+
2. Add a .env `cp .env.example .env`
1215

13-
Test uses locally installed firebase to invoke commands for deploying function. The test also requires that you have
14-
gcloud CLI installed and authenticated (`gcloud auth login`).
16+
### Running setup and tests
1517

16-
Integration test is triggered by invoking HTTP function integrationTest which in turns invokes each function trigger
17-
by issuing actions necessary to trigger it (e.g. write to storage bucket).
18+
This will deploy functions with unique names, set up environment for running the
19+
jest files, and run the jest test suite.
20+
21+
```bash
22+
yarn start
23+
```
1824

19-
### Debugging
25+
## TODO
2026

21-
The status and result of each test is stored in RTDB of the project used for testing. You can also inspect Cloud Logging
22-
for more clues.
27+
[x] Deploy functions with unique name
28+
[x] Update existing tests to use jest (v1 and v2)
29+
[] Add missing coverage for v1 and v2 (WIP)
30+
[] Ensure proper teardown of resources (only those for current test run)
31+
[] Python runtime support
32+
[] Capture test outcome for use by CI

0 commit comments

Comments
 (0)