@@ -115,20 +115,22 @@ the integration tests, and only execute the unit tests.
115
115
116
116
### Integration Testing
117
117
118
- A suite of integration tests are available in the Admin SDK source code. These tests
119
- are designed to run against an actual Firebase project. If you do not already have one
120
- suitable for running the tests against, you can create a new project in the
118
+ Integration tests are executed against a real life Firebase project. If you do not already
119
+ have one suitable for running the tests against, you can create a new project in the
121
120
[ Firebase Console] ( https://console.firebase.google.com ) following the setup guide below.
122
- Otherwise you can obtain the following credentials from your current project:
121
+ If you already have a Firebase project, you'll need to obtain credentials to communicate and
122
+ authorize access to your Firebase project:
123
123
124
124
125
- 1 . Service account certificate: This can be downloaded as a JSON file from the
126
- ** 'Settings > Service Accounts'** tab of the Firebase console when you click the
127
- ** 'Generate new private key'** button. Copy the file into the repo so it's available
128
- at ` src/firebase.google.com/go/testdata/integration_cert.json ` .
125
+ 1 . Service account certificate: This allows access to your Firebase project through a service account
126
+ which is required for all integration tests. This can be downloaded as a JSON file from the
127
+ ** Settings > Service Accounts** tab of the Firebase console when you click the
128
+ ** Generate new private key** button. Copy the file into the repo so it's available at
129
+ ` src/firebase.google.com/go/testdata/integration_cert.json ` .
129
130
130
131
131
- 2 . Web API key: This is displayed in the ** 'Settings > General'** tab of the Firebase console
132
+ 2 . Web API key: This allows for Auth sign-in needed for some Authentication and Tenant Management
133
+ integration tests. This is displayed in the ** Settings > General** tab of the Firebase console
132
134
after enabling Authentication as described in the steps below. Copy it and save to a new text
133
135
file at ` src/firebase.google.com/go/testdata/integration_apikey.txt ` .
134
136
@@ -137,58 +139,63 @@ Set up your Firebase project as follows:
137
139
138
140
139
141
1 . Enable Authentication:
140
- 1 . Go to the Firebase Console, and select ** ' Authentication' ** from the ** ' Build' ** menu.
141
- 2 . Click on ** ' Get Started' ** .
142
- 3 . Select ** ' Sign-in method > Add new provider > Email/Password' ** then enable both the
143
- ** ' Email/Password' ** and ** ' Email link (passwordless sign-in)' ** options.
142
+ 1 . Go to the Firebase Console, and select ** Authentication** from the ** Build** menu.
143
+ 2 . Click on ** Get Started** .
144
+ 3 . Select ** Sign-in method > Add new provider > Email/Password** then enable both the
145
+ ** Email/Password** and ** Email link (passwordless sign-in)** options.
144
146
145
147
146
148
2 . Enable Firestore:
147
- 1 . Go to the Firebase Console, and select ** ' Firestore Database' ** from the ** ' Build' ** menu.
148
- 2 . Click on the ** ' Create database' ** button. You can choose to set up Firestore either in
149
+ 1 . Go to the Firebase Console, and select ** Firestore Database** from the ** Build** menu.
150
+ 2 . Click on the ** Create database** button. You can choose to set up Firestore either in
149
151
the production mode or in the test mode.
150
152
151
153
152
154
3 . Enable Realtime Database:
153
- 1 . Go to the Firebase Console, and select ** ' Realtime Database' ** from the ** ' Build' ** menu.
154
- 2 . Click on the ** ' Create database' ** button. You can choose to set up the Realtime database
155
+ 1 . Go to the Firebase Console, and select ** Realtime Database** from the ** Build** menu.
156
+ 2 . Click on the ** Create Database ** button. You can choose to set up the Realtime Database
155
157
either in the locked mode or in the test mode.
156
- 3 . In the ** 'Data'** tab click on the kebab menu (3 dots) and select ** 'Create Database'** .
157
- 4 . Enter your Project ID (Found in the ** 'General'** tab in ** 'Account Settings'** ) as the
158
- ** 'Realtime Database reference'** . Again, you can choose to set up the Realtime database
158
+
159
+ > ** Note:** Integration tests are not run against the default Realtime Database reference and are
160
+ instead run against a database created at ` https://{PROJECT_ID}.firebaseio.com ` .
161
+ This second Realtime Database reference is created in the following steps.
162
+
163
+ 3 . In the ** Data** tab click on the kebab menu (3 dots) and select ** Create Database** .
164
+ 4 . Enter your Project ID (Found in the ** General** tab in ** Account Settings** ) as the
165
+ ** Realtime Database reference** . Again, you can choose to set up the Realtime Database
159
166
either in the locked mode or in the test mode.
160
167
161
168
162
169
4 . Enable Storage:
163
- 1 . Go to the Firebase Console, and select ** ' Storage' ** from the ** ' Build' ** menu.
164
- 2 . Click on the ** ' Get started' ** button. You can choose to set up the Realtime database
170
+ 1 . Go to the Firebase Console, and select ** Storage** from the ** Build** menu.
171
+ 2 . Click on the ** Get started** button. You can choose to set up Cloud Storage
165
172
either in the production mode or in the test mode.
166
173
167
174
168
175
5 . Enable the IAM API:
169
- 1 . Go to the[ Google Cloud Platform Console ] ( https://console.cloud.google.com )
170
- and make sureyour Firebase project is selected.
171
- 2 . Select ** ' APIs & Services' ** from the main menu, and click the
172
- ** ' ENABLE APIS AND SERVICES' ** button.
173
- 3 . Search for and enable ** ' Identity and Access Management (IAM) API' ** by Google Enterprise API.
176
+ 1 . Go to the [ Google Cloud console ] ( https://console.cloud.google.com )
177
+ and make sure your Firebase project is selected.
178
+ 2 . Select ** APIs & Services** from the main menu, and click the
179
+ ** ENABLE APIS AND SERVICES** button.
180
+ 3 . Search for and enable ** Identity and Access Management (IAM) API** by Google Enterprise API.
174
181
175
182
176
183
6 . Enable Tenant Management:
177
184
1 . Go to
178
- [ Google Developers Console | Identity Platform] ( https://console.cloud.google.com/customer-identity/ )
179
- and if it is not already enabled, click ** ' Enable' ** .
180
- 2 . Then follow
181
- [ this guide ] ( https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy )
182
- to enable multi-tenancy .
185
+ [ Google Cloud console | Identity Platform] ( https://console.cloud.google.com/customer-identity/ )
186
+ and if it is not already enabled, click ** Enable** .
187
+ 2 . Then
188
+ [ enable multi-tenancy ] ( https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy )
189
+ for your project .
183
190
184
191
185
- 7 . Ensure your service account has the ** ' Firebase Authentication Admin' ** role. This is required
192
+ 7 . Ensure your service account has the ** Firebase Authentication Admin** role. This is required
186
193
to ensure that exported user records contain the password hashes of the user accounts:
187
- 1 . Go to [ Google Cloud Platform Console / IAM & admin] ( https://console.cloud.google.com/iam-admin ) .
188
- 2 . Find your service account in the list. If not added click the ** ' pencil' ** icon to edit its
194
+ 1 . Go to [ Google Cloud console | IAM & admin] ( https://console.cloud.google.com/iam-admin ) .
195
+ 2 . Find your service account in the list. If not added click the ** pencil** icon to edit its
189
196
permissions.
190
- 3 . Click ** ' ADD ANOTHER ROLE' ** and choose ** ' Firebase Authentication Admin' ** .
191
- 4 . Click ** ' SAVE' ** .
197
+ 3 . Click ** ADD ANOTHER ROLE** and choose ** Firebase Authentication Admin** .
198
+ 4 . Click ** SAVE** .
192
199
193
200
194
201
Now you can invoke the test suite as follows:
0 commit comments