@@ -115,35 +115,81 @@ 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.
119
- These tests are designed to run against an actual Firebase project. Create a new
120
- project in the [ Firebase Console] ( https://console.firebase.google.com ) , if you
121
- do not already have one suitable for running the tests against. Then obtain the
122
- following credentials from the project:
123
-
124
- 1 . * Service account certificate* : This can be downloaded as a JSON file from
125
- the "Settings > Service Accounts" tab of the Firebase console. Click
126
- "GENERATE NEW PRIVATE KEY" and copy the file into your Go workspace as
127
- ` src/firebase.google.com/go/testdata/integration_cert.json ` .
128
- 2 . * Web API key* : This is displayed in the "Settings > General" tab of the
129
- console. Copy it and save to a new text file. Copy this text file into
130
- your Go workspace as
131
- ` src/firebase.google.com/go/testdata/integration_apikey.txt ` .
132
-
133
- You'll also need to grant your service account the 'Firebase Authentication Admin' role. This is
134
- required to ensure that exported user records contain the password hashes of the user accounts:
135
- 1 . Go to [ Google Cloud Platform Console / IAM & admin] ( https://console.cloud.google.com/iam-admin ) .
136
- 2 . Find your service account in the list, and click the 'pencil' icon to edit it's permissions.
137
- 3 . Click 'ADD ANOTHER ROLE' and choose 'Firebase Authentication Admin'.
138
- 4 . Click 'SAVE'.
139
-
140
- Some of the integration tests require an
141
- [ Identity Platform] ( https://cloud.google.com/identity-platform/ ) project with multi-tenancy
142
- [ enabled] ( https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy ) .
143
- An existing Firebase project can be upgraded to an Identity Platform project without losing any
144
- functionality via the
145
- [ Identity Platform Marketplace Page] ( https://console.cloud.google.com/customer-identity ) . Note that
146
- charges may be incurred for active users beyond the Identity Platform free tier.
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
121
+ [ Firebase Console] ( https://console.firebase.google.com ) following the setup guide below.
122
+ Otherwise you can obtain the following credentials from your current project:
123
+
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 ` .
129
+
130
+
131
+ 2 . Web API key: This is displayed in the ** 'Settings > General'** tab of the Firebase console
132
+ after enabling Authentication as described in the steps below. Copy it and save to a new text
133
+ file at ` src/firebase.google.com/go/testdata/integration_apikey.txt ` .
134
+
135
+
136
+ Set up your Firebase project as follows:
137
+
138
+
139
+ 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.
144
+
145
+
146
+ 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
+ the production mode or in the test mode.
150
+
151
+
152
+ 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
+ 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
159
+ either in the locked mode or in the test mode.
160
+
161
+
162
+ 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
165
+ either in the production mode or in the test mode.
166
+
167
+
168
+ 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.
174
+
175
+
176
+ 6 . Enable Tenant Management:
177
+ 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.
183
+
184
+
185
+ 7 . Ensure your service account has the ** 'Firebase Authentication Admin'** role. This is required
186
+ 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
189
+ permissions.
190
+ 3 . Click ** 'ADD ANOTHER ROLE'** and choose ** 'Firebase Authentication Admin'** .
191
+ 4 . Click ** 'SAVE'** .
192
+
147
193
148
194
Now you can invoke the test suite as follows:
149
195
0 commit comments