Skip to content

Commit 7dd5dbf

Browse files
committed
squash changes for rebase onto stephenarosaj/fdc-integration-tests
1 parent b70fe23 commit 7dd5dbf

File tree

11 files changed

+2838
-1241
lines changed

11 files changed

+2838
-1241
lines changed

CONTRIBUTING.md

Lines changed: 64 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -248,47 +248,79 @@ to ensure that exported user records contain the password hashes of the user acc
248248
9. Setup your project for Firebase Data Connect integration tests:
249249
1. Set up Data Connect in the Firebase Console:
250250
1. Go to the Firebase Console, and select **Data Connect** from the **Build** menu.
251-
2. Click on **Get Started**. You can skip any Gemini generation of your schema
252-
or operations - you must create these manually.
251+
2. Click on **Get Started**. Skip any steps related to Gemini generation.
253252
3. Select **Create a new Cloud SQL instance**.
254-
4. Set your **Location** to `us-west2`
255-
5. Set your **Cloud SQL instance ID** to `my-instance`
256-
6. Set your **Database name** to `my-database`
257-
7. Set your **Service ID** to `my-service`
258-
8. Click **Submit**. This operation may take up to 10 minutes to complete - you may
259-
continue setting up while this completes.
260-
2. Set up your Data Connect schema locally:
261-
1. Run the following commands from the command line to setup your data connect app:
253+
4. When prompted, you must use the following specific configuration values, as the integration tests are hard-coded to expect them:
254+
* Set your **Location** to `us-west2`
255+
* Set your **Cloud SQL instance ID** to `my-instance`
256+
* Set your **Database name** to `my-database`
257+
* Set your **Service ID** to `my-service`
258+
5. Click **Submit**.
259+
> **Note:** This operation may take up to 10 minutes to complete - you may
260+
continue with Step 2 of setup while this completes.
261+
2. Set up your Data Connect schema and operations locally:
262+
1. First, create a separate directory for the test configuration and initialize Data Connect.
263+
(Make sure to replace `<PROJECT_ID>` with your actual Firebase Project ID).
262264
```bash
263265
$ mkdir fdc-integration-test
264266
$ cd fdc-integration-test
265267
$ firebase init dataconnect --project <PROJECT_ID>
266268
```
267-
2. The setup script should say **"Your project already has existing services."**
268-
Select the service you just created, `us-west2/my-service`.
269-
3. When asked to use an app template, select `no`.
270-
4. The set up should complete, and should have created a file `fdc-integration-test/dataconnect/schema/schema.gql`.
271-
5. Paste the following lines into `schema.gql`:
272-
```gql
273-
type User @table(key: ["id"]) {
274-
id: String!
275-
name: String!
276-
address: String!
277-
}
278-
279-
type Email @table {
280-
id: String!
281-
subject: String!
282-
date: Date!
283-
text: String!
284-
from: User!
285-
}
269+
2. During the interactive init process, follow these prompts:
270+
* When it says "Your project already has existing services," select the service you just created: `us-west2/my-service`.
271+
* When asked to use an app template, select `no`.
272+
3. The set up should be complete.
273+
4. Create your schema and operations:
274+
```bash
275+
$ touch fdc-integration-test/dataconnect/example/operations.gql
286276
```
287-
6. Run the following commands from `fdc-integration-test/` to deploy your schema:
277+
* Paste the following lines into `fdc-integration-test/dataconnect/example/operations.gql`:
278+
```gql
279+
query ListUsersPublic @auth(level: PUBLIC, insecureReason: "test") { users { id, name, address } }
280+
query ListUsersUserAnon @auth(level: USER_ANON, insecureReason: "test") { users { id, name, address } }
281+
query ListUsersUser @auth(level: USER, insecureReason: "test") { users { id, name, address } }
282+
query ListUsersUserEmailVerified @auth(level: USER_EMAIL_VERIFIED, insecureReason: "test") { users { id, name, address } }
283+
query ListUsersNoAccess @auth(level: NO_ACCESS) { users { id, name, address } }
284+
query ListUsersImpersonationAnon @auth(level: USER_ANON) {users(where: { id: { eq_expr: "auth.uid" } }) { id, name, address } }
285+
query GetUser($id: User_Key!) @auth(level: NO_ACCESS) { user(key: $id) { id name } }
286+
287+
query ListEmails @auth(level: NO_ACCESS) { emails { id subject text date from { name } } }
288+
query GetEmail($id: String!) @auth(level: NO_ACCESS) { email(id: $id) { id, subject, date, text, from { id name address } } }
289+
290+
mutation upsertFredUser @auth(level: NO_ACCESS) { user_upsert(data: { id: "fred_id", address: "32 Elm St.", name: "Fred" }) }
291+
mutation updateFredrickUserImpersonation @auth(level: USER) { user_update( key: { id_expr: "auth.uid" }, data: { address: "64 Elm St. North", name: "Fredrick" } ) }
292+
mutation upsertJeffUser @auth(level: NO_ACCESS) { user_upsert(data: { id: "jeff_id", address: "99 Oak St.", name: "Jeff" }) }
293+
294+
mutation upsertJeffEmail @auth(level: NO_ACCESS) { email_upsert(data: { id: "jeff_email+id", subject: "free bitcoin inside", date: "1999-12-31", text: "get pranked! LOL!", fromId: "jeff_id", }) }
295+
296+
mutation InsertEmailPublic @auth(level: PUBLIC, insecureReason: "test") { email_insert(data: { id_expr: "uuidV4()", subject: "PublicEmail", date: "1999-12-31", text: "PublicEmail", fromId: "jeff_id", }) }
297+
mutation InsertEmailUserAnon @auth(level: USER_ANON, insecureReason: "test") { email_insert(data: { id_expr: "uuidV4()", subject: "UserAnonEmail", date: "1999-12-31", text: "UserAnonEmail", fromId: "jeff_id", }) }
298+
mutation InsertEmailUser @auth(level: USER, insecureReason: "test") { email_insert(data: { id_expr: "uuidV4()", subject: "UserEmail", date: "1999-12-31", text: "UserEmail", fromId: "jeff_id", }) }
299+
mutation InsertEmailUserEmailVerified @auth(level: USER_EMAIL_VERIFIED, insecureReason: "test") { email_insert(data: { id_expr: "uuidV4()", subject: "UserEmailVerifiedEmail", date: "1999-12-31", text: "UserEmailVerifiedEmail", fromId: "jeff_id", }) }
300+
mutation InsertEmailNoAccess @auth(level: NO_ACCESS) { email_insert(data: { id_expr: "uuidV4()", subject: "NoAccessEmail", date: "1999-12-31", text: "NoAccessEmail", fromId: "jeff_id", }) }
301+
mutation InsertEmailImpersonation @auth(level: NO_ACCESS) { email_insert(data: { id_expr: "uuidV4()", subject: "ImpersonatedEmail", date: "1999-12-31", text: "ImpersonatedEmail", fromId_expr: "auth.uid" }) }
302+
```
303+
* Paste the following lines into `fdc-integration-test/dataconnect/schema/schema.gql`:
304+
```gql
305+
type User @table(key: ["id"]) {
306+
id: String!
307+
name: String!
308+
address: String!
309+
}
310+
311+
type Email @table {
312+
id: String!
313+
subject: String!
314+
date: Date!
315+
text: String!
316+
from: User!
317+
}
318+
```
319+
5. Finally, deploy your new schema and operations from within the `fdc-integration-test` directory:
288320
```bash
289-
$ firebase deploy --only dataconnect
321+
$ firebase deploy --only dataconnect --project <PROJECT_ID>
290322
```
291-
7. When asked if you'd like to execute changes, select `Execute all`.
323+
6. When asked if you'd like to execute changes, select `Execute all`.
292324
293325
Finally, to run the integration test suite:
294326

firebase-debug.log

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[debug] [2025-09-12T00:08:18.312Z] ----------------------------------------------------------------------
2+
[debug] [2025-09-12T00:08:18.314Z] Command: /Users/stephenarosaj/.nvm/versions/node/v22.18.0/bin/node /Users/stephenarosaj/.nvm/versions/node/v22.18.0/bin/firebase deploy --only dataconnect --project fdc-permanent-billing-00
3+
[debug] [2025-09-12T00:08:18.315Z] CLI Version: 14.15.2
4+
[debug] [2025-09-12T00:08:18.315Z] Platform: darwin
5+
[debug] [2025-09-12T00:08:18.315Z] Node Version: v22.18.0
6+
[debug] [2025-09-12T00:08:18.315Z] Time: Thu Sep 11 2025 17:08:18 GMT-0700 (Pacific Daylight Time)
7+
[debug] [2025-09-12T00:08:18.315Z] ----------------------------------------------------------------------
8+
[debug]
9+
[error]
10+
[error] Error: Not in a Firebase app directory (could not locate firebase.json)

0 commit comments

Comments
 (0)