From bd7613666a7796584cada93f0753d843b18109fc Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 27 Sep 2018 13:47:22 -0400 Subject: [PATCH] Firestore: add new conformance tests. --- .../testdata/create-all-transforms.textproto | 64 ++++++++++++++ .../create-arrayremove-multi.textproto | 61 +++++++++++++ .../create-arrayremove-nested.textproto | 48 ++++++++++ ...reate-arrayremove-noarray-nested.textproto | 12 +++ .../create-arrayremove-noarray.textproto | 12 +++ .../create-arrayremove-with-st.textproto | 12 +++ .../testdata/create-arrayremove.textproto | 47 ++++++++++ .../create-arrayunion-multi.textproto | 61 +++++++++++++ .../create-arrayunion-nested.textproto | 48 ++++++++++ ...create-arrayunion-noarray-nested.textproto | 12 +++ .../create-arrayunion-noarray.textproto | 12 +++ .../create-arrayunion-with-st.textproto | 12 +++ .../unit/testdata/create-arrayunion.textproto | 47 ++++++++++ .../create-st-with-empty-map.textproto | 45 ++++++++++ .../query-arrayremove-cursor.textproto | 23 +++++ .../query-arrayremove-where.textproto | 19 ++++ .../query-arrayunion-cursor.textproto | 23 +++++ .../testdata/query-arrayunion-where.textproto | 19 ++++ .../testdata/set-all-transforms.textproto | 61 +++++++++++++ .../testdata/set-arrayremove-multi.textproto | 58 +++++++++++++ .../testdata/set-arrayremove-nested.textproto | 45 ++++++++++ .../set-arrayremove-noarray-nested.textproto | 12 +++ .../set-arrayremove-noarray.textproto | 12 +++ .../set-arrayremove-with-st.textproto | 12 +++ .../unit/testdata/set-arrayremove.textproto | 44 ++++++++++ .../testdata/set-arrayunion-multi.textproto | 58 +++++++++++++ .../testdata/set-arrayunion-nested.textproto | 45 ++++++++++ .../set-arrayunion-noarray-nested.textproto | 12 +++ .../testdata/set-arrayunion-noarray.textproto | 12 +++ .../testdata/set-arrayunion-with-st.textproto | 12 +++ .../unit/testdata/set-arrayunion.textproto | 44 ++++++++++ .../testdata/set-st-with-empty-map.textproto | 42 +++++++++ .../tests/unit/testdata/test-suite.binproto | Bin 38337 -> 55406 bytes .../testdata/update-all-transforms.textproto | 67 ++++++++++++++ .../update-arrayremove-alone.textproto | 36 ++++++++ .../update-arrayremove-multi.textproto | 69 +++++++++++++++ .../update-arrayremove-nested.textproto | 52 +++++++++++ ...pdate-arrayremove-noarray-nested.textproto | 12 +++ .../update-arrayremove-noarray.textproto | 12 +++ .../update-arrayremove-with-st.textproto | 12 +++ .../testdata/update-arrayremove.textproto | 50 +++++++++++ .../update-arrayunion-alone.textproto | 36 ++++++++ .../update-arrayunion-multi.textproto | 69 +++++++++++++++ .../update-arrayunion-nested.textproto | 52 +++++++++++ ...update-arrayunion-noarray-nested.textproto | 12 +++ .../update-arrayunion-noarray.textproto | 12 +++ .../update-arrayunion-with-st.textproto | 12 +++ .../unit/testdata/update-arrayunion.textproto | 50 +++++++++++ .../update-paths-all-transforms.textproto | 82 ++++++++++++++++++ .../update-paths-arrayremove-alone.textproto | 39 +++++++++ .../update-paths-arrayremove-multi.textproto | 76 ++++++++++++++++ .../update-paths-arrayremove-nested.textproto | 59 +++++++++++++ ...paths-arrayremove-noarray-nested.textproto | 15 ++++ ...update-paths-arrayremove-noarray.textproto | 15 ++++ ...update-paths-arrayremove-with-st.textproto | 15 ++++ .../update-paths-arrayremove.textproto | 57 ++++++++++++ .../update-paths-arrayunion-alone.textproto | 39 +++++++++ .../update-paths-arrayunion-multi.textproto | 76 ++++++++++++++++ .../update-paths-arrayunion-nested.textproto | 59 +++++++++++++ ...-paths-arrayunion-noarray-nested.textproto | 15 ++++ .../update-paths-arrayunion-noarray.textproto | 15 ++++ .../update-paths-arrayunion-with-st.textproto | 15 ++++ .../update-paths-arrayunion.textproto | 57 ++++++++++++ .../update-paths-fp-dup-transforms.textproto | 23 +++++ .../update-paths-st-with-empty-map.textproto | 51 +++++++++++ .../update-st-with-empty-map.textproto | 48 ++++++++++ 66 files changed, 2355 insertions(+) create mode 100644 firestore/tests/unit/testdata/create-all-transforms.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove-multi.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove-nested.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove-noarray.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove-with-st.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayremove.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion-multi.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion-nested.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion-noarray.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion-with-st.textproto create mode 100644 firestore/tests/unit/testdata/create-arrayunion.textproto create mode 100644 firestore/tests/unit/testdata/create-st-with-empty-map.textproto create mode 100644 firestore/tests/unit/testdata/query-arrayremove-cursor.textproto create mode 100644 firestore/tests/unit/testdata/query-arrayremove-where.textproto create mode 100644 firestore/tests/unit/testdata/query-arrayunion-cursor.textproto create mode 100644 firestore/tests/unit/testdata/query-arrayunion-where.textproto create mode 100644 firestore/tests/unit/testdata/set-all-transforms.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove-multi.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove-nested.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove-noarray.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove-with-st.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayremove.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion-multi.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion-nested.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion-noarray.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion-with-st.textproto create mode 100644 firestore/tests/unit/testdata/set-arrayunion.textproto create mode 100644 firestore/tests/unit/testdata/set-st-with-empty-map.textproto create mode 100644 firestore/tests/unit/testdata/update-all-transforms.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-alone.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-multi.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-noarray.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove-with-st.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayremove.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-alone.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-multi.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-noarray.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion-with-st.textproto create mode 100644 firestore/tests/unit/testdata/update-arrayunion.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-all-transforms.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-alone.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-multi.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-noarray.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove-with-st.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayremove.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-alone.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-multi.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-noarray-nested.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-noarray.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion-with-st.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-arrayunion.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-fp-dup-transforms.textproto create mode 100644 firestore/tests/unit/testdata/update-paths-st-with-empty-map.textproto create mode 100644 firestore/tests/unit/testdata/update-st-with-empty-map.textproto diff --git a/firestore/tests/unit/testdata/create-all-transforms.textproto b/firestore/tests/unit/testdata/create-all-transforms.textproto new file mode 100644 index 000000000000..bbdf19e4df4a --- /dev/null +++ b/firestore/tests/unit/testdata/create-all-transforms.textproto @@ -0,0 +1,64 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "create: all transforms in a single call" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayremove-multi.textproto b/firestore/tests/unit/testdata/create-arrayremove-multi.textproto new file mode 100644 index 000000000000..f80d65b2381a --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove-multi.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "create: multiple ArrayRemove fields" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayremove-nested.textproto b/firestore/tests/unit/testdata/create-arrayremove-nested.textproto new file mode 100644 index 000000000000..97756c306c18 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove-nested.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "create: nested ArrayRemove field" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayremove-noarray-nested.textproto b/firestore/tests/unit/testdata/create-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000000..4ec0cb3b9376 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "create: ArrayRemove cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayremove-noarray.textproto b/firestore/tests/unit/testdata/create-arrayremove-noarray.textproto new file mode 100644 index 000000000000..969b8d9dd84e --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "create: ArrayRemove cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayremove-with-st.textproto b/firestore/tests/unit/testdata/create-arrayremove-with-st.textproto new file mode 100644 index 000000000000..b6ea3224de73 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "create: The ServerTimestamp sentinel cannot be in an ArrayUnion" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayremove.textproto b/firestore/tests/unit/testdata/create-arrayremove.textproto new file mode 100644 index 000000000000..e8e4bb3980db --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayremove.textproto @@ -0,0 +1,47 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "create: ArrayRemove with data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayunion-multi.textproto b/firestore/tests/unit/testdata/create-arrayunion-multi.textproto new file mode 100644 index 000000000000..ec3cb72f5b1b --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion-multi.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "create: multiple ArrayUnion fields" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayunion-nested.textproto b/firestore/tests/unit/testdata/create-arrayunion-nested.textproto new file mode 100644 index 000000000000..e6e81bc1d7a2 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion-nested.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "create: nested ArrayUnion field" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-arrayunion-noarray-nested.textproto b/firestore/tests/unit/testdata/create-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000000..4c0afe443048 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "create: ArrayUnion cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayunion-noarray.textproto b/firestore/tests/unit/testdata/create-arrayunion-noarray.textproto new file mode 100644 index 000000000000..7b791fa4154d --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "create: ArrayUnion cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayunion-with-st.textproto b/firestore/tests/unit/testdata/create-arrayunion-with-st.textproto new file mode 100644 index 000000000000..a1bf4a90d1c4 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "create: The ServerTimestamp sentinel cannot be in an ArrayUnion" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/create-arrayunion.textproto b/firestore/tests/unit/testdata/create-arrayunion.textproto new file mode 100644 index 000000000000..98cb6ad8acb1 --- /dev/null +++ b/firestore/tests/unit/testdata/create-arrayunion.textproto @@ -0,0 +1,47 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "create: ArrayUnion with data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/create-st-with-empty-map.textproto b/firestore/tests/unit/testdata/create-st-with-empty-map.textproto new file mode 100644 index 000000000000..37e7e074abec --- /dev/null +++ b/firestore/tests/unit/testdata/create-st-with-empty-map.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "create: ServerTimestamp beside an empty map" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/query-arrayremove-cursor.textproto b/firestore/tests/unit/testdata/query-arrayremove-cursor.textproto new file mode 100644 index 000000000000..3c926da963e6 --- /dev/null +++ b/firestore/tests/unit/testdata/query-arrayremove-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove is not permitted in queries. + +description: "query: ArrayRemove in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "[\"ArrayRemove\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/firestore/tests/unit/testdata/query-arrayremove-where.textproto b/firestore/tests/unit/testdata/query-arrayremove-where.textproto new file mode 100644 index 000000000000..000b76350e01 --- /dev/null +++ b/firestore/tests/unit/testdata/query-arrayremove-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove is not permitted in queries. + +description: "query: ArrayRemove in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "[\"ArrayRemove\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/firestore/tests/unit/testdata/query-arrayunion-cursor.textproto b/firestore/tests/unit/testdata/query-arrayunion-cursor.textproto new file mode 100644 index 000000000000..e8a61104d1b3 --- /dev/null +++ b/firestore/tests/unit/testdata/query-arrayunion-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion is not permitted in queries. + +description: "query: ArrayUnion in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "[\"ArrayUnion\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/firestore/tests/unit/testdata/query-arrayunion-where.textproto b/firestore/tests/unit/testdata/query-arrayunion-where.textproto new file mode 100644 index 000000000000..94923134e2b1 --- /dev/null +++ b/firestore/tests/unit/testdata/query-arrayunion-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion is not permitted in queries. + +description: "query: ArrayUnion in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "[\"ArrayUnion\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-all-transforms.textproto b/firestore/tests/unit/testdata/set-all-transforms.textproto new file mode 100644 index 000000000000..bf18f9a5b12a --- /dev/null +++ b/firestore/tests/unit/testdata/set-all-transforms.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "set: all transforms in a single call" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayremove-multi.textproto b/firestore/tests/unit/testdata/set-arrayremove-multi.textproto new file mode 100644 index 000000000000..9b62fe191953 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove-multi.textproto @@ -0,0 +1,58 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "set: multiple ArrayRemove fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayremove-nested.textproto b/firestore/tests/unit/testdata/set-arrayremove-nested.textproto new file mode 100644 index 000000000000..617609c5a39e --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove-nested.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "set: nested ArrayRemove field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayremove-noarray-nested.textproto b/firestore/tests/unit/testdata/set-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000000..2efa34a59f19 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "set: ArrayRemove cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayremove-noarray.textproto b/firestore/tests/unit/testdata/set-arrayremove-noarray.textproto new file mode 100644 index 000000000000..e7aa209ea22b --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "set: ArrayRemove cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayremove-with-st.textproto b/firestore/tests/unit/testdata/set-arrayremove-with-st.textproto new file mode 100644 index 000000000000..353025b59ff5 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "set: The ServerTimestamp sentinel cannot be in an ArrayUnion" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayremove.textproto b/firestore/tests/unit/testdata/set-arrayremove.textproto new file mode 100644 index 000000000000..8aa6b60d0156 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayremove.textproto @@ -0,0 +1,44 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "set: ArrayRemove with data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayunion-multi.textproto b/firestore/tests/unit/testdata/set-arrayunion-multi.textproto new file mode 100644 index 000000000000..e515bfa8d188 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion-multi.textproto @@ -0,0 +1,58 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "set: multiple ArrayUnion fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayunion-nested.textproto b/firestore/tests/unit/testdata/set-arrayunion-nested.textproto new file mode 100644 index 000000000000..f8abeb0d0004 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion-nested.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "set: nested ArrayUnion field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-arrayunion-noarray-nested.textproto b/firestore/tests/unit/testdata/set-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000000..2b4170f431a3 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "set: ArrayUnion cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayunion-noarray.textproto b/firestore/tests/unit/testdata/set-arrayunion-noarray.textproto new file mode 100644 index 000000000000..e08af3a07f14 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "set: ArrayUnion cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayunion-with-st.textproto b/firestore/tests/unit/testdata/set-arrayunion-with-st.textproto new file mode 100644 index 000000000000..37a7a132e750 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "set: The ServerTimestamp sentinel cannot be in an ArrayUnion" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/set-arrayunion.textproto b/firestore/tests/unit/testdata/set-arrayunion.textproto new file mode 100644 index 000000000000..4751e0c0e322 --- /dev/null +++ b/firestore/tests/unit/testdata/set-arrayunion.textproto @@ -0,0 +1,44 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "set: ArrayUnion with data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/set-st-with-empty-map.textproto b/firestore/tests/unit/testdata/set-st-with-empty-map.textproto new file mode 100644 index 000000000000..5e187983f995 --- /dev/null +++ b/firestore/tests/unit/testdata/set-st-with-empty-map.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "set: ServerTimestamp beside an empty map" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/test-suite.binproto b/firestore/tests/unit/testdata/test-suite.binproto index 38b7e8804682a8775ce94483a6c93d786a27c468..0619a2fc130a73084197d843798714e287e0f187 100644 GIT binary patch delta 7841 zcmb`Me{3AZ6~~!fC$=Y18lN3ISv&T6Vms%Je{k!>Hs}1nMj?qE=P)6ys^FIO-6lTd zyEAteD%ZUb{-L5R5@_1eMk1v|ZCVH==v1Y&G$N|{Q%%97B}G+3Y5%CyKLVkx5EP-# z%jtC@ddE!|Aj(cO)54B~h0g>XOwi zxo?s@joDA{))T1*b@F(7m%O7(?w`y_ZvfmH>ckJN-Y4p66o(G&R%#%Ks%xRJ9*~bf zK4O4;6${g^D#&LQ`K*R73a}Lq!;SfOR&506k^q}5^|lcC3-Ro<9MiIz^c0n>bj%}- z$RX;`lr3wq=$!Pjt!hj?fFBSC`iX=ow<`FG05`jw8u2;2o*`cMHJQ07L~kXB=ZA(m z#X>DapI==$4BCGuz!u9{QqN@dnCuAjSX`fpN#CbIhPvHB&KFysTu!=V$2zW#(O8FS zp*YpEXbs@+1t{|bm_Zu~&QS$wPZ0&)Ebt`M84?yH;?All2!1R;Wa&tpn90UxNm(vV zMMkditJtg4DQ{n3XenG8<3oGo`{_!mm~*@!#RY z^%%e&DEt8N-9{SsY!1 z>(2r>Rd5<)Q#L zF~#<}+cZJnrZShxF!U2!iOH}&4#Qp&pk#YAGU{-78c);~0T{;#r?uoeYr_Ejf*_iC z@}U=chK5%rz0gnXC{20|a_RL;!fKCqGhBu)be6g=7hN3xO+0kLKMSlD@kCW?{;PF; zp#6Qqb0)~2VdyHAw4w|{R|@$u85UVG!#*Sj0FGj35;N#eRPqV~%qx270QjE;NmAs%4Wa2;dJtspA5+vYB4|k=hk1 zms~;o@&=4=)}O3>9KdZX33k(ButFLQ4qq9l95`BvR3s$A!7kejt15;m+e}LdGkCQA z98NVnUi&nFgSIIfP$)(fjg$c>qU#v|Z?laV)z0XIbZV^(I(^XazOe3ifDAOS5`tso zpNjm)()PyY8vt%RF-ztYGJDxcBx6`AsVfWk#r1=&&8~xmbvU)amqT;3P%9(kqy>zD zB}AIN=02LjcLChw@?-8@!x6r){x;O&@?$)A%yS$^w^K*%gF5^U873`9C5B1m-*gkM z$S{fi!nP~E-hZ%6_=fsTKv|+4t5BFB6$Yp!^Y^kXrpOFQx#V(cE{W~+YzYK={qPWc z|G)vz{yJff<;;h|%8%%BluO}X8L_@KUWHE`+$R>DBmYP+!V_Tz&S0#(Kvk3tW4;VN zkpC&L62*tA+Va;2_kiFdB1D!he zYVR@--5CBR{`8PBQd(N<*2XBU6et}of!E0#p&^|oU6xp#F;Lr8r=Wp zO@{{Kcg~Zhj|l$FaP@c!RD4Awv);P#hFZJD$;@#^{j2G@8lN1m9`db8k{8G83hR_@ z6=qKHA)fn~&A$PDOoW|OTpbhVOiM;(X9~J|sJdOAjbWYgY04b(3Mnh8&wV=Q-}GJ+ zUvV_tp%z`gETStga$V{C9{ine+?EBCVXRsb)o znE&JS+86&+9mn9CT}gi1RI^UjPU785yRLdHP+D{*kT*= z?I`)l836>p3?On^G*C$lMo*+OskEHXv(u^Ah=wnJ?vDM9qniRn#61e&7N;#+o!i(H RHMY5FR0{ZuyEmZ+{}0zSnsERC delta 306 zcmaF2f%)KSrVW=_Hy5y*FmBf1c3|YX&%~vkT$Gwvk~;alrs8IOese~aiHuyvlj9|n zCfkeUO^%jWI(e;F<0Q$+n;%NGGffU+(wOXDB(ZsgtON7rIwf7k&5CN4jGJF*Ml(*n zZ7^}Npz)%~IfiwUHycmb+->@ii7!ovNq~imor^IY$Y9>wWnm)CvWKR+o}kIQ y`=)PRF+q%(F9Bo-$h11JA!jE4X52h!TDBNV8zYzcWSKQmlSS7(+|08fNdo}FJ7$Rh diff --git a/firestore/tests/unit/testdata/update-all-transforms.textproto b/firestore/tests/unit/testdata/update-all-transforms.textproto new file mode 100644 index 000000000000..225cc61e405e --- /dev/null +++ b/firestore/tests/unit/testdata/update-all-transforms.textproto @@ -0,0 +1,67 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "update: all transforms in a single call" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-alone.textproto b/firestore/tests/unit/testdata/update-arrayremove-alone.textproto new file mode 100644 index 000000000000..8c79a31d5052 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-alone.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayRemove, then no update operation should +# be produced. + +description: "update: ArrayRemove alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-multi.textproto b/firestore/tests/unit/testdata/update-arrayremove-multi.textproto new file mode 100644 index 000000000000..2362b6e09458 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-multi.textproto @@ -0,0 +1,69 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +# b is not in the mask because it will be set in the transform. c must be in the +# mask: it should be replaced entirely. The transform will set c.d to the +# timestamp, but the update will delete the rest of c. + +description: "update: multiple ArrayRemove fields" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-nested.textproto b/firestore/tests/unit/testdata/update-arrayremove-nested.textproto new file mode 100644 index 000000000000..143790179eaf --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-nested.textproto @@ -0,0 +1,52 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update: nested ArrayRemove field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-noarray-nested.textproto b/firestore/tests/unit/testdata/update-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000000..04eca965c688 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "update: ArrayRemove cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-noarray.textproto b/firestore/tests/unit/testdata/update-arrayremove-noarray.textproto new file mode 100644 index 000000000000..bbd27bf017e1 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update: ArrayRemove cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayremove-with-st.textproto b/firestore/tests/unit/testdata/update-arrayremove-with-st.textproto new file mode 100644 index 000000000000..4888b44f1c01 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayremove.textproto b/firestore/tests/unit/testdata/update-arrayremove.textproto new file mode 100644 index 000000000000..3b767cf486c3 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayremove.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update: ArrayRemove with data" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-alone.textproto b/firestore/tests/unit/testdata/update-arrayunion-alone.textproto new file mode 100644 index 000000000000..ec12818da74c --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-alone.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayUnion, then no update operation should +# be produced. + +description: "update: ArrayUnion alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-multi.textproto b/firestore/tests/unit/testdata/update-arrayunion-multi.textproto new file mode 100644 index 000000000000..8edf6a3af046 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-multi.textproto @@ -0,0 +1,69 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +# b is not in the mask because it will be set in the transform. c must be in the +# mask: it should be replaced entirely. The transform will set c.d to the +# timestamp, but the update will delete the rest of c. + +description: "update: multiple ArrayUnion fields" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-nested.textproto b/firestore/tests/unit/testdata/update-arrayunion-nested.textproto new file mode 100644 index 000000000000..217e2e2ca775 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-nested.textproto @@ -0,0 +1,52 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update: nested ArrayUnion field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-noarray-nested.textproto b/firestore/tests/unit/testdata/update-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000000..0326781830ec --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "update: ArrayUnion cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-noarray.textproto b/firestore/tests/unit/testdata/update-arrayunion-noarray.textproto new file mode 100644 index 000000000000..c199f9f73c91 --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update: ArrayUnion cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayunion-with-st.textproto b/firestore/tests/unit/testdata/update-arrayunion-with-st.textproto new file mode 100644 index 000000000000..ee022f8492bc --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-arrayunion.textproto b/firestore/tests/unit/testdata/update-arrayunion.textproto new file mode 100644 index 000000000000..81b240b891bb --- /dev/null +++ b/firestore/tests/unit/testdata/update-arrayunion.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update: ArrayUnion with data" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-all-transforms.textproto b/firestore/tests/unit/testdata/update-paths-all-transforms.textproto new file mode 100644 index 000000000000..8cfad4732034 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-all-transforms.textproto @@ -0,0 +1,82 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "update-paths: all transforms in a single call" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + field_paths: < + field: "d" + > + json_values: "1" + json_values: "\"ServerTimestamp\"" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "[\"ArrayRemove\", 4, 5, 6]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-alone.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-alone.textproto new file mode 100644 index 000000000000..68f0e147b2de --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-alone.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayRemove, then no update operation should +# be produced. + +description: "update-paths: ArrayRemove alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayRemove\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-multi.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-multi.textproto new file mode 100644 index 000000000000..b60c3f36a6c0 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-multi.textproto @@ -0,0 +1,76 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "update-paths: multiple ArrayRemove fields" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + json_values: "1" + json_values: "[\"ArrayRemove\", 1, 2, 3]" + json_values: "{\"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-nested.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-nested.textproto new file mode 100644 index 000000000000..381be19d553f --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-nested.textproto @@ -0,0 +1,59 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update-paths: nested ArrayRemove field" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "{\"c\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-noarray-nested.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000000..35f6c67b2e56 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-noarray-nested.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "update-paths: ArrayRemove cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-noarray.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-noarray.textproto new file mode 100644 index 000000000000..45cab48dd9e1 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-noarray.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update-paths: ArrayRemove cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, [\"ArrayRemove\", 1, 2, 3]]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove-with-st.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove-with-st.textproto new file mode 100644 index 000000000000..67b92a3ef3b9 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove-with-st.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update-paths: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayRemove\", 1, \"ServerTimestamp\", 3]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayremove.textproto b/firestore/tests/unit/testdata/update-paths-arrayremove.textproto new file mode 100644 index 000000000000..d3866676ede0 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayremove.textproto @@ -0,0 +1,57 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update-paths: ArrayRemove with data" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "[\"ArrayRemove\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-alone.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-alone.textproto new file mode 100644 index 000000000000..48100e0abceb --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-alone.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayUnion, then no update operation should +# be produced. + +description: "update-paths: ArrayUnion alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-multi.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-multi.textproto new file mode 100644 index 000000000000..03772e5ddd1a --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-multi.textproto @@ -0,0 +1,76 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "update-paths: multiple ArrayUnion fields" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + json_values: "1" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "{\"d\": [\"ArrayUnion\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-nested.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-nested.textproto new file mode 100644 index 000000000000..1420e4e2806b --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-nested.textproto @@ -0,0 +1,59 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update-paths: nested ArrayUnion field" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "{\"c\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-noarray-nested.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000000..ab75bf38a3ae --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-noarray-nested.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "update-paths: ArrayUnion cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-noarray.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-noarray.textproto new file mode 100644 index 000000000000..fac72644fc38 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-noarray.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update-paths: ArrayUnion cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, [\"ArrayRemove\", 1, 2, 3]]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion-with-st.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion-with-st.textproto new file mode 100644 index 000000000000..d194c09bd775 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion-with-st.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update-paths: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, \"ServerTimestamp\", 3]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-arrayunion.textproto b/firestore/tests/unit/testdata/update-paths-arrayunion.textproto new file mode 100644 index 000000000000..fc56c1e29471 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-arrayunion.textproto @@ -0,0 +1,57 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update-paths: ArrayUnion with data" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-paths-fp-dup-transforms.textproto b/firestore/tests/unit/testdata/update-paths-fp-dup-transforms.textproto new file mode 100644 index 000000000000..a84725a8d4d1 --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-fp-dup-transforms.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The same field cannot occur more than once, even if all the operations are +# transforms. + +description: "update-paths: duplicate field path with only transforms" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "\"ServerTimestamp\"" + json_values: "[\"ArrayUnion\", 4, 5, 6]" + is_error: true +> diff --git a/firestore/tests/unit/testdata/update-paths-st-with-empty-map.textproto b/firestore/tests/unit/testdata/update-paths-st-with-empty-map.textproto new file mode 100644 index 000000000000..a54a241565de --- /dev/null +++ b/firestore/tests/unit/testdata/update-paths-st-with-empty-map.textproto @@ -0,0 +1,51 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "update-paths: ServerTimestamp beside an empty map" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "{\"b\": {}, \"c\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/firestore/tests/unit/testdata/update-st-with-empty-map.textproto b/firestore/tests/unit/testdata/update-st-with-empty-map.textproto new file mode 100644 index 000000000000..1901de2a15ef --- /dev/null +++ b/firestore/tests/unit/testdata/update-st-with-empty-map.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "update: ServerTimestamp beside an empty map" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +>