diff --git a/client/document.go b/client/document.go index ccbdfd688c..ada47cc8f9 100644 --- a/client/document.go +++ b/client/document.go @@ -777,6 +777,11 @@ func (doc *Document) GenerateDocID() (DocID, error) { return DocID{}, err } + // The DocID must take into consideration the schema root, this ensures that + // otherwise identical documents created using different schema will have different + // document IDs - we do not want cross-schema docID collisions. + bytes = append(bytes, []byte(doc.collectionDefinition.Schema.Root)...) + cid, err := ccid.NewSHA256CidV1(bytes) if err != nil { return DocID{}, err diff --git a/docs/data_format_changes/i2688-doc-id-includes-schema.md b/docs/data_format_changes/i2688-doc-id-includes-schema.md new file mode 100644 index 0000000000..caca83656c --- /dev/null +++ b/docs/data_format_changes/i2688-doc-id-includes-schema.md @@ -0,0 +1,3 @@ +# Incorporate schema root into docID + +DocID generation now incorporates schema root, meaning documents created against different schema will no longer clash. This change also means that all the docIDs and commit CIDs have changed. diff --git a/docs/website/guides/schema-relationship.md b/docs/website/guides/schema-relationship.md index 59745b60f2..5eb77dc8d4 100644 --- a/docs/website/guides/schema-relationship.md +++ b/docs/website/guides/schema-relationship.md @@ -81,7 +81,7 @@ mutation { ```graphql mutation { - create_User(input: {name: "Alice", username: "awesomealice", age: 35, address_id: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d"}) { + create_User(input: {name: "Alice", username: "awesomealice", age: 35, address_id: "bae-be6d8024-4953-5a92-84b4-f042d25230c6"}) { _key } } diff --git a/docs/website/guides/time-traveling-queries.md b/docs/website/guides/time-traveling-queries.md index 0c952861bd..2bc36956f1 100644 --- a/docs/website/guides/time-traveling-queries.md +++ b/docs/website/guides/time-traveling-queries.md @@ -21,7 +21,7 @@ A powerful feature of a time-traveling query is that very little work is require query { User ( cid: "bafybeieqnthjlvr64aodivtvtwgqelpjjvkmceyz4aqerkk5h23kjoivmu", - dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" + dockey: "bae-d4303725-7db9-53d2-b324-f3ee44020e52" ) { name age diff --git a/docs/website/references/query-specification/database-api.md b/docs/website/references/query-specification/database-api.md index e2cec7d671..8a40583f89 100644 --- a/docs/website/references/query-specification/database-api.md +++ b/docs/website/references/query-specification/database-api.md @@ -106,7 +106,7 @@ Commits queries also work with aggregates, grouping, limit, offset, order, docke There is __typename introspection keyword that works on all queries that does not appear to be documented anywhere, for example: ```graphql -commits(dockey: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { +commits(dockey: "bae-d4303725-7db9-53d2-b324-f3ee44020e52") { cid __typename } diff --git a/internal/db/backup_test.go b/internal/db/backup_test.go index 486080db81..0d84a394d1 100644 --- a/internal/db/backup_test.go +++ b/internal/db/backup_test.go @@ -80,7 +80,7 @@ func TestBasicExport_WithNormalFormatting_NoError(t *testing.T) { require.NoError(t, err) expectedMap := map[string]any{} - data := []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","_docIDNew":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","age":40,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`) + data := []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"},{"_docID":"bae-f8a0f1e4-129e-50ab-98ed-1aa110810fb2","_docIDNew":"bae-f8a0f1e4-129e-50ab-98ed-1aa110810fb2","age":40,"name":"Bob"}]}`) err = json.Unmarshal(data, &expectedMap) require.NoError(t, err) require.EqualValues(t, expectedMap, fileMap) @@ -145,7 +145,7 @@ func TestBasicExport_WithPrettyFormatting_NoError(t *testing.T) { require.NoError(t, err) expectedMap := map[string]any{} - data := []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","_docIDNew":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","age":40,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`) + data := []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"},{"_docID":"bae-f8a0f1e4-129e-50ab-98ed-1aa110810fb2","_docIDNew":"bae-f8a0f1e4-129e-50ab-98ed-1aa110810fb2","age":40,"name":"Bob"}]}`) err = json.Unmarshal(data, &expectedMap) require.NoError(t, err) require.EqualValues(t, expectedMap, fileMap) @@ -210,7 +210,7 @@ func TestBasicExport_WithSingleCollection_NoError(t *testing.T) { require.NoError(t, err) expectedMap := map[string]any{} - data := []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}]}`) + data := []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}]}`) err = json.Unmarshal(data, &expectedMap) require.NoError(t, err) require.EqualValues(t, expectedMap, fileMap) @@ -252,10 +252,10 @@ func TestBasicExport_WithMultipleCollectionsAndUpdate_NoError(t *testing.T) { col2, err := db.GetCollectionByName(ctx, "Book") require.NoError(t, err) - doc3, err := client.NewDocFromJSON([]byte(`{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`), col2.Definition()) + doc3, err := client.NewDocFromJSON([]byte(`{"name": "John and the sourcerers' stone", "author": "bae-7fca96a2-5f01-5558-a81f-09b47587f26d"}`), col2.Definition()) require.NoError(t, err) - doc4, err := client.NewDocFromJSON([]byte(`{"name": "Game of chains", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`), col2.Definition()) + doc4, err := client.NewDocFromJSON([]byte(`{"name": "Game of chains", "author": "bae-7fca96a2-5f01-5558-a81f-09b47587f26d"}`), col2.Definition()) require.NoError(t, err) err = col2.Create(ctx, doc3) @@ -287,7 +287,7 @@ func TestBasicExport_WithMultipleCollectionsAndUpdate_NoError(t *testing.T) { require.NoError(t, err) expectedMap := map[string]any{} - data := []byte(`{"Book":[{"_docID":"bae-4399f189-138d-5d49-9e25-82e78463677b","_docIDNew":"bae-78a40f28-a4b8-5dca-be44-392b0f96d0ff","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"Game of chains"},{"_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da","_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"John and the sourcerers' stone"}],"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}]}`) + data := []byte(`{"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117", "_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone"}, {"_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b", "_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"Game of chains"}], "User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John"}, {"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob"}]}`) err = json.Unmarshal(data, &expectedMap) require.NoError(t, err) require.EqualValues(t, expectedMap, fileMap) @@ -345,7 +345,7 @@ func TestBasicExport_EnsureFileOverwrite_NoError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","_docIDNew":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","age":40,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`), + []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":40,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`), 0664, ) require.NoError(t, err) @@ -360,7 +360,7 @@ func TestBasicExport_EnsureFileOverwrite_NoError(t *testing.T) { require.NoError(t, err) expectedMap := map[string]any{} - data := []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}]}`) + data := []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}]}`) err = json.Unmarshal(data, &expectedMap) require.NoError(t, err) require.EqualValues(t, expectedMap, fileMap) @@ -393,7 +393,7 @@ func TestBasicImport_WithMultipleCollectionsAndObjects_NoError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`{"Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","_docIDNew":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","age":40,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`), + []byte(`{"Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":40,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`), 0664, ) require.NoError(t, err) @@ -412,7 +412,7 @@ func TestBasicImport_WithMultipleCollectionsAndObjects_NoError(t *testing.T) { col1, err := db.getCollectionByName(ctx, "Address") require.NoError(t, err) - key1, err := client.NewDocIDFromString("bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f") + key1, err := client.NewDocIDFromString("bae-41e1a410-df86-5846-939e-4470a8d8cb0c") require.NoError(t, err) _, err = col1.Get(ctx, key1, false) require.NoError(t, err) @@ -420,12 +420,12 @@ func TestBasicImport_WithMultipleCollectionsAndObjects_NoError(t *testing.T) { col2, err := db.getCollectionByName(ctx, "User") require.NoError(t, err) - key2, err := client.NewDocIDFromString("bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df") + key2, err := client.NewDocIDFromString("bae-7fca96a2-5f01-5558-a81f-09b47587f26d") require.NoError(t, err) _, err = col2.Get(ctx, key2, false) require.NoError(t, err) - key3, err := client.NewDocIDFromString("bae-e933420a-988a-56f8-8952-6c245aebd519") + key3, err := client.NewDocIDFromString("bae-7fca96a2-5f01-5558-a81f-09b47587f26d") require.NoError(t, err) _, err = col2.Get(ctx, key3, false) require.NoError(t, err) @@ -456,7 +456,7 @@ func TestBasicImport_WithJSONArray_ReturnError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`["Address":[{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","_docIDNew":"bae-b94880d1-e6d2-542f-b9e0-5a369fafd0df","age":40,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]]`), + []byte(`["Address":[{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}],"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":40,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]]`), 0664, ) require.NoError(t, err) @@ -492,7 +492,7 @@ func TestBasicImport_WithObjectCollection_ReturnError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`{"Address":{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}}`), + []byte(`{"Address":{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}}`), 0664, ) require.NoError(t, err) @@ -528,7 +528,7 @@ func TestBasicImport_WithInvalidFilepath_ReturnError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`{"Address":{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}}`), + []byte(`{"Address":{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}}`), 0664, ) require.NoError(t, err) @@ -565,7 +565,7 @@ func TestBasicImport_WithInvalidCollection_ReturnError(t *testing.T) { err = os.WriteFile( filepath, - []byte(`{"Addresses":{"_docID":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","_docIDNew":"bae-8096f2c1-ea4c-5226-8ba5-17fc4b68ac1f","city":"Toronto","street":"101 Maple St"}}`), + []byte(`{"Addresses":{"_docID":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","_docIDNew":"bae-41e1a410-df86-5846-939e-4470a8d8cb0c","city":"Toronto","street":"101 Maple St"}}`), 0664, ) require.NoError(t, err) diff --git a/tests/integration/acp/index/query_with_relation_test.go b/tests/integration/acp/index/query_with_relation_test.go index 8a0d8c7d74..19229b3f67 100644 --- a/tests/integration/acp/index/query_with_relation_test.go +++ b/tests/integration/acp/index/query_with_relation_test.go @@ -47,7 +47,7 @@ func createAuthorBooksSchemaWithPolicyAndCreateDocs() []any { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 Doc: `{ "name": "John Grisham", "age": 65, @@ -66,29 +66,29 @@ func createAuthorBooksSchemaWithPolicyAndCreateDocs() []any { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ Identity: acpUtils.Actor1Identity, CollectionID: 1, - Doc: `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ Identity: acpUtils.Actor1Identity, CollectionID: 1, - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, } } diff --git a/tests/integration/acp/query/fixture.go b/tests/integration/acp/query/fixture.go index 2b05b48232..be521e700f 100644 --- a/tests/integration/acp/query/fixture.go +++ b/tests/integration/acp/query/fixture.go @@ -104,45 +104,37 @@ func getSetupEmployeeCompanyActions() []any { }, testUtils.CreateDoc{ CollectionID: 0, - Doc: ` - { - "name": "PubEmp in PubCompany", - "salary": 10000, - "company": "bae-1ab7ac86-3c68-5abb-b526-803858c9dccf" - } - `, + DocMap: map[string]any{ + "name": "PubEmp in PubCompany", + "salary": 10000, + "company": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 0, - Doc: ` - { - "name": "PubEmp in PrivateCompany", - "salary": 20000, - "company": "bae-4aef4bd6-e2ee-5075-85a5-4d64bbf80bca" - } - `, + DocMap: map[string]any{ + "name": "PubEmp in PrivateCompany", + "salary": 20000, + "company": testUtils.NewDocIndex(1, 1), + }, }, testUtils.CreateDoc{ CollectionID: 0, Identity: acpUtils.Actor1Identity, - Doc: ` - { - "name": "PrivateEmp in PubCompany", - "salary": 30000, - "company": "bae-1ab7ac86-3c68-5abb-b526-803858c9dccf" - } - `, + DocMap: map[string]any{ + "name": "PrivateEmp in PubCompany", + "salary": 30000, + "company": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 0, Identity: acpUtils.Actor1Identity, - Doc: ` - { - "name": "PrivateEmp in PrivateCompany", - "salary": 40000, - "company": "bae-4aef4bd6-e2ee-5075-85a5-4d64bbf80bca" - } - `, + DocMap: map[string]any{ + "name": "PrivateEmp in PrivateCompany", + "salary": 40000, + "company": testUtils.NewDocIndex(1, 1), + }, }, } } diff --git a/tests/integration/acp/query/relation_objects_test.go b/tests/integration/acp/query/relation_objects_test.go index 76bd264ac8..6a1b79f8b1 100644 --- a/tests/integration/acp/query/relation_objects_test.go +++ b/tests/integration/acp/query/relation_objects_test.go @@ -36,14 +36,14 @@ func TestACP_QueryManyToOneRelationObjectsWithoutIdentity(t *testing.T) { } `, Results: []map[string]any{ - { - "name": "PubEmp in PrivateCompany", - "company": nil, - }, { "name": "PubEmp in PubCompany", "company": map[string]any{"name": "Public Company"}, }, + { + "name": "PubEmp in PrivateCompany", + "company": nil, + }, }, }, }, @@ -113,14 +113,14 @@ func TestACP_QueryManyToOneRelationObjectsWithIdentity(t *testing.T) { "name": "PrivateEmp in PrivateCompany", "company": map[string]any{"name": "Private Company"}, }, - { - "name": "PubEmp in PrivateCompany", - "company": map[string]any{"name": "Private Company"}, - }, { "name": "PubEmp in PubCompany", "company": map[string]any{"name": "Public Company"}, }, + { + "name": "PubEmp in PrivateCompany", + "company": map[string]any{"name": "Private Company"}, + }, }, }, }, @@ -191,14 +191,14 @@ func TestACP_QueryManyToOneRelationObjectsWithWrongIdentity(t *testing.T) { } `, Results: []map[string]any{ - { - "name": "PubEmp in PrivateCompany", - "company": nil, - }, { "name": "PubEmp in PubCompany", "company": map[string]any{"name": "Public Company"}, }, + { + "name": "PubEmp in PrivateCompany", + "company": nil, + }, }, }, }, diff --git a/tests/integration/acp/register_and_delete_test.go b/tests/integration/acp/register_and_delete_test.go index ef4e80ec22..1392c3719a 100644 --- a/tests/integration/acp/register_and_delete_test.go +++ b/tests/integration/acp/register_and_delete_test.go @@ -393,7 +393,7 @@ func TestACP_CreateWithIdentityAndDeleteWithoutIdentity_CanNotDelete(t *testing. `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -501,7 +501,7 @@ func TestACP_CreateWithIdentityAndDeleteWithWrongIdentity_CanNotDelete(t *testin `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, diff --git a/tests/integration/acp/register_and_read_test.go b/tests/integration/acp/register_and_read_test.go index 0ad80c4953..280d85637e 100644 --- a/tests/integration/acp/register_and_read_test.go +++ b/tests/integration/acp/register_and_read_test.go @@ -92,7 +92,7 @@ func TestACP_CreateWithoutIdentityAndReadWithoutIdentity_CanRead(t *testing.T) { `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -182,7 +182,7 @@ func TestACP_CreateWithoutIdentityAndReadWithIdentity_CanRead(t *testing.T) { `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -274,7 +274,7 @@ func TestACP_CreateWithIdentityAndReadWithIdentity_CanRead(t *testing.T) { `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, diff --git a/tests/integration/acp/register_and_update_test.go b/tests/integration/acp/register_and_update_test.go index 4a51aa6aec..e9ebb52e27 100644 --- a/tests/integration/acp/register_and_update_test.go +++ b/tests/integration/acp/register_and_update_test.go @@ -111,7 +111,7 @@ func TestACP_CreateWithoutIdentityAndUpdateWithoutIdentity_CanUpdate(t *testing. Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad Lone", "age": int64(28), }, @@ -217,7 +217,7 @@ func TestACP_CreateWithoutIdentityAndUpdateWithIdentity_CanUpdate(t *testing.T) `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad Lone", "age": int64(28), }, @@ -327,7 +327,7 @@ func TestACP_CreateWithIdentityAndUpdateWithIdentity_CanUpdate(t *testing.T) { `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad Lone", "age": int64(28), }, @@ -443,7 +443,7 @@ func TestACP_CreateWithIdentityAndUpdateWithoutIdentity_CanNotUpdate(t *testing. `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -563,7 +563,7 @@ func TestACP_CreateWithIdentityAndUpdateWithWrongIdentity_CanNotUpdate(t *testin `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -678,7 +678,7 @@ func TestACP_CreateWithIdentityAndUpdateWithoutIdentityGQL_CanNotUpdate(t *testi `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, @@ -797,7 +797,7 @@ func TestACP_CreateWithIdentityAndUpdateWithWrongIdentityGQL_CanNotUpdate(t *tes `, Results: []map[string]any{ { - "_docID": "bae-1e608f7d-b01e-5dd5-ad4a-9c6cc3005a36", + "_docID": "bae-9d443d0c-52f6-568b-8f74-e8ff0825697b", "name": "Shahzad", "age": int64(28), }, diff --git a/tests/integration/backup/one_to_many/export_test.go b/tests/integration/backup/one_to_many/export_test.go index 3626535b9d..9126456149 100644 --- a/tests/integration/backup/one_to_many/export_test.go +++ b/tests/integration/backup/one_to_many/export_test.go @@ -28,7 +28,7 @@ func TestBackupExport_JustUserCollection_NoError(t *testing.T) { Config: client.BackupConfig{ Collections: []string{"User"}, }, - ExpectedContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, }, }, } @@ -49,7 +49,10 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing. }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + DocMap: map[string]any{ + "name": "John and the sourcerers' stone", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.UpdateDoc{ CollectionID: 0, @@ -57,7 +60,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing. Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}],"Book":[{"_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da","_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"John and the sourcerers' stone"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117","_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`, }, }, } @@ -78,11 +81,17 @@ func TestBackupExport_AllCollectionsMultipleDocsAndMultipleDocUpdate_NoError(t * }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + DocMap: map[string]any{ + "name": "John and the sourcerers' stone", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "Game of chains", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + DocMap: map[string]any{ + "name": "Game of chains", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.UpdateDoc{ CollectionID: 0, @@ -90,7 +99,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndMultipleDocUpdate_NoError(t * Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}],"Book":[{"_docID":"bae-4399f189-138d-5d49-9e25-82e78463677b","_docIDNew":"bae-78a40f28-a4b8-5dca-be44-392b0f96d0ff","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"Game of chains"},{"_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da","_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"John and the sourcerers' stone"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117","_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"},{"_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b","_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"Game of chains"}]}`, }, }, } diff --git a/tests/integration/backup/one_to_many/import_test.go b/tests/integration/backup/one_to_many/import_test.go index 193867cc8d..70260d58d8 100644 --- a/tests/integration/backup/one_to_many/import_test.go +++ b/tests/integration/backup/one_to_many/import_test.go @@ -42,16 +42,16 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing }`, Results: []map[string]any{ { - "name": "Smith", - "age": int64(31), + "name": "John", + "age": int64(30), }, { "name": "Bob", "age": int64(32), }, { - "name": "John", - "age": int64(30), + "name": "Smith", + "age": int64(31), }, }, }, @@ -64,10 +64,10 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing }`, Results: []map[string]any{ { - "name": "John and the sourcerers' stone", + "name": "Game of chains", }, { - "name": "Game of chains", + "name": "John and the sourcerers' stone", }, }, }, @@ -84,28 +84,28 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr ImportContent: `{ "Book":[ { - "_docID":"bae-4399f189-138d-5d49-9e25-82e78463677b", - "_docIDNew":"bae-78a40f28-a4b8-5dca-be44-392b0f96d0ff", - "author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b", + "_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8", + "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"Game of chains" }, { - "_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da", - "_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5", - "author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117", + "_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3", + "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone" } ], "User":[ { - "_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927", - "_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927", + "_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", + "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob" }, { - "_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519", - "_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", + "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John" } @@ -122,11 +122,11 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr }`, Results: []map[string]any{ { - "name": "Bob", + "name": "John", "age": int64(31), }, { - "name": "John", + "name": "Bob", "age": int64(31), }, }, @@ -145,13 +145,13 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr { "name": "Game of chains", "author": map[string]any{ - "_docID": "bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", }, }, { "name": "John and the sourcerers' stone", "author": map[string]any{ - "_docID": "bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", }, }, }, diff --git a/tests/integration/backup/one_to_one/export_test.go b/tests/integration/backup/one_to_one/export_test.go index b52e0bb02f..fb63d52208 100644 --- a/tests/integration/backup/one_to_one/export_test.go +++ b/tests/integration/backup/one_to_one/export_test.go @@ -28,7 +28,7 @@ func TestBackupExport_JustUserCollection_NoError(t *testing.T) { Config: client.BackupConfig{ Collections: []string{"User"}, }, - ExpectedContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, }, }, } @@ -49,7 +49,10 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing. }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + DocMap: map[string]any{ + "name": "John and the sourcerers' stone", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.UpdateDoc{ CollectionID: 0, @@ -57,7 +60,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing. Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}],"Book":[{"_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da","_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"John and the sourcerers' stone"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315","_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`, }, }, } @@ -93,7 +96,11 @@ func TestBackupExport_DoubleReletionship_NoError(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519", "favourite": "bae-0648f44e-74e8-593b-a662-3310ec278927"}`, + DocMap: map[string]any{ + "name": "John and the sourcerers' stone", + "author": testUtils.NewDocIndex(0, 0), + "favourite": testUtils.NewDocIndex(0, 1), + }, }, testUtils.UpdateDoc{ CollectionID: 0, @@ -101,7 +108,7 @@ func TestBackupExport_DoubleReletionship_NoError(t *testing.T) { Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}],"Book":[{"_docID":"bae-45b1def4-4e63-5a93-a1b8-f7b08e682164","_docIDNew":"bae-add2ccfe-84a1-519c-ab7d-c54b43909532","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","favourite_id":"bae-0648f44e-74e8-593b-a662-3310ec278927","name":"John and the sourcerers' stone"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-ccf9da82-8ed6-5133-b64f-558c21bc8dfd","_docIDNew":"bae-27ae099a-fa7d-5a66-a919-6c3b0322d17c","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"}]}`, }, }, } @@ -137,7 +144,11 @@ func TestBackupExport_DoubleReletionshipWithUpdate_NoError(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{"name": "John and the sourcerers' stone", "author": "bae-e933420a-988a-56f8-8952-6c245aebd519", "favourite": "bae-0648f44e-74e8-593b-a662-3310ec278927"}`, + DocMap: map[string]any{ + "name": "John and the sourcerers' stone", + "author": testUtils.NewDocIndex(0, 0), + "favourite": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, @@ -149,7 +160,7 @@ func TestBackupExport_DoubleReletionshipWithUpdate_NoError(t *testing.T) { Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}],"Book":[{"_docID":"bae-45b1def4-4e63-5a93-a1b8-f7b08e682164","_docIDNew":"bae-add2ccfe-84a1-519c-ab7d-c54b43909532","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","favourite_id":"bae-0648f44e-74e8-593b-a662-3310ec278927","name":"John and the sourcerers' stone"},{"_docID":"bae-da7f2d88-05c4-528a-846a-0d18ab26603b","_docIDNew":"bae-da7f2d88-05c4-528a-846a-0d18ab26603b","name":"Game of chains"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-ccf9da82-8ed6-5133-b64f-558c21bc8dfd","_docIDNew":"bae-27ae099a-fa7d-5a66-a919-6c3b0322d17c","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"},{"_docID":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","_docIDNew":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","name":"Game of chains"}]}`, }, }, } diff --git a/tests/integration/backup/one_to_one/import_test.go b/tests/integration/backup/one_to_one/import_test.go index 8c3aff4fe2..4451841163 100644 --- a/tests/integration/backup/one_to_one/import_test.go +++ b/tests/integration/backup/one_to_one/import_test.go @@ -42,16 +42,16 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing }`, Results: []map[string]any{ { - "name": "Smith", - "age": int64(31), + "name": "John", + "age": int64(30), }, { "name": "Bob", "age": int64(32), }, { - "name": "John", - "age": int64(30), + "name": "Smith", + "age": int64(31), }, }, }, @@ -64,10 +64,10 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing }`, Results: []map[string]any{ { - "name": "John and the sourcerers' stone", + "name": "Game of chains", }, { - "name": "Game of chains", + "name": "John and the sourcerers' stone", }, }, }, @@ -84,22 +84,22 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr ImportContent: `{ "Book":[ { - "_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da", - "_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5", - "author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315", + "_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97", + "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone" } ], "User":[ { - "_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927", - "_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927", + "_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", + "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob" }, { - "_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519", - "_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", + "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John" } @@ -116,11 +116,11 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr }`, Results: []map[string]any{ { - "name": "Bob", + "name": "John", "age": int64(31), }, { - "name": "John", + "name": "Bob", "age": int64(31), }, }, @@ -139,7 +139,7 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr { "name": "John and the sourcerers' stone", "author": map[string]any{ - "_docID": "bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", }, }, }, @@ -159,26 +159,26 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndMultipleUpdatedD { "_docID":"bae-4399f189-138d-5d49-9e25-82e78463677b", "_docIDNew":"bae-78a40f28-a4b8-5dca-be44-392b0f96d0ff", - "author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"Game of chains" }, { - "_docID":"bae-5cf2fec3-d8ed-50d5-8286-39109853d2da", - "_docIDNew":"bae-edeade01-2d21-5d6d-aadf-efc5a5279de5", - "author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315", + "_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97", + "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone" } ], "User":[ { - "_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927", - "_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927", + "_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", + "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob" }, { - "_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519", - "_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162", + "_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", + "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John" } @@ -211,7 +211,7 @@ func TestBackupImport_DoubleRelationshipWithUpdate_NoError(t *testing.T) { `, }, testUtils.BackupImport{ - ImportContent: `{"Book":[{"_docID":"bae-236c14bd-4621-5d43-bc03-4442f3b8719e","_docIDNew":"bae-6dbb3738-d3db-5121-acee-6fbdd97ff7a8","author_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","favourite_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"John and the sourcerers' stone"},{"_docID":"bae-da7f2d88-05c4-528a-846a-0d18ab26603b","_docIDNew":"bae-da7f2d88-05c4-528a-846a-0d18ab26603b","name":"Game of chains"}],"User":[{"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927","_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927","age":31,"name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}]}`, + ImportContent: `{"Book":[{"_docID":"bae-236c14bd-4621-5d43-bc03-4442f3b8719e","_docIDNew":"bae-6dbb3738-d3db-5121-acee-6fbdd97ff7a8","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"},{"_docID":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","_docIDNew":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","name":"Game of chains"}],"User":[{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"}]}`, }, testUtils.Request{ Request: ` diff --git a/tests/integration/backup/self_reference/export_test.go b/tests/integration/backup/self_reference/export_test.go index 9a0c73a8d1..b31216a1ad 100644 --- a/tests/integration/backup/self_reference/export_test.go +++ b/tests/integration/backup/self_reference/export_test.go @@ -26,13 +26,13 @@ func TestBackupExport_Simple_NoError(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - Doc: `{"name": "Bob", "age": 31, "boss": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + Doc: `{"name": "Bob", "age": 31, "boss": "bae-a2162ff0-3257-50f1-ba2f-39c299921220"}`, }, testUtils.BackupExport{ Config: client.BackupConfig{ Collections: []string{"User"}, }, - ExpectedContent: `{"User":[{"_docID":"bae-790e7e49-f2e3-5ad6-83d9-5dfb6d8ba81d","_docIDNew":"bae-790e7e49-f2e3-5ad6-83d9-5dfb6d8ba81d","age":31,"boss_id":"bae-e933420a-988a-56f8-8952-6c245aebd519","name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","_docIDNew":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","age":30,"name":"John"},{"_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","_docIDNew":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","age":31,"boss_id":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","name":"Bob"}]}`, }, }, } @@ -49,7 +49,7 @@ func TestBackupExport_MultipleDocsAndDocUpdate_NoError(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - Doc: `{"name": "Bob", "age": 31, "boss": "bae-e933420a-988a-56f8-8952-6c245aebd519"}`, + Doc: `{"name": "Bob", "age": 31, "boss": "bae-a2162ff0-3257-50f1-ba2f-39c299921220"}`, }, testUtils.UpdateDoc{ CollectionID: 0, @@ -57,7 +57,7 @@ func TestBackupExport_MultipleDocsAndDocUpdate_NoError(t *testing.T) { Doc: `{"age": 31}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-790e7e49-f2e3-5ad6-83d9-5dfb6d8ba81d","_docIDNew":"bae-067fd15e-32a1-5681-8f41-c423f563e21b","age":31,"boss_id":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","name":"Bob"},{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-807ea028-6c13-5f86-a72b-46e8b715a162","age":31,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","_docIDNew":"bae-99fbc678-167f-5325-bdf1-79fa76039125","age":31,"name":"John"},{"_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","_docIDNew":"bae-98531af8-dda5-5993-b140-1495fa8f1576","age":31,"boss_id":"bae-99fbc678-167f-5325-bdf1-79fa76039125","name":"Bob"}]}`, }, }, } diff --git a/tests/integration/backup/self_reference/import_test.go b/tests/integration/backup/self_reference/import_test.go index 0a68a66d85..5ddb800a41 100644 --- a/tests/integration/backup/self_reference/import_test.go +++ b/tests/integration/backup/self_reference/import_test.go @@ -25,13 +25,13 @@ func TestBackupSelfRefImport_Simple_NoError(t *testing.T) { ImportContent: `{ "User":[ { - "_docID":"bae-790e7e49-f2e3-5ad6-83d9-5dfb6d8ba81d", + "_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102", "age":31, - "boss_id":"bae-e933420a-988a-56f8-8952-6c245aebd519", + "boss_id":"bae-a2162ff0-3257-50f1-ba2f-39c299921220", "name":"Bob" }, { - "_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519", + "_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220", "age":30, "name":"John" } @@ -49,16 +49,16 @@ func TestBackupSelfRefImport_Simple_NoError(t *testing.T) { } }`, Results: []map[string]any{ + { + "name": "John", + "boss": nil, + }, { "name": "Bob", "boss": map[string]any{ "name": "John", }, }, - { - "name": "John", - "boss": nil, - }, }, }, }, @@ -71,10 +71,10 @@ func TestBackupSelfRefImport_SelfRef_NoError(t *testing.T) { expectedExportData := `{` + `"User":[` + `{` + - `"_docID":"bae-0648f44e-74e8-593b-a662-3310ec278927",` + - `"_docIDNew":"bae-0648f44e-74e8-593b-a662-3310ec278927",` + + `"_docID":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` + + `"_docIDNew":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` + `"age":31,` + - `"boss_id":"bae-0648f44e-74e8-593b-a662-3310ec278927",` + + `"boss_id":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` + `"name":"Bob"` + `}` + `]` + @@ -98,7 +98,7 @@ func TestBackupSelfRefImport_SelfRef_NoError(t *testing.T) { testUtils.UpdateDoc{ NodeID: immutable.Some(0), Doc: `{ - "boss_id": "bae-0648f44e-74e8-593b-a662-3310ec278927" + "boss_id": "bae-20631b3d-1498-51f1-be29-5c0effbfa646" }`, }, testUtils.BackupExport{ @@ -162,8 +162,8 @@ func TestBackupSelfRefImport_PrimaryRelationWithSecondCollection_NoError(t *test "Book":[ { "name":"John and the sourcerers' stone", - "author":"bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", - "reviewedBy":"bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + "author":"bae-da91935a-9176-57ea-ba68-afe05781da16", + "reviewedBy":"bae-da91935a-9176-57ea-ba68-afe05781da16" } ] }`, @@ -221,8 +221,8 @@ func TestBackupSelfRefImport_PrimaryRelationWithSecondCollectionWrongOrder_NoErr "Book":[ { "name":"John and the sourcerers' stone", - "author":"bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", - "reviewedBy":"bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + "author":"bae-da91935a-9176-57ea-ba68-afe05781da16", + "reviewedBy":"bae-da91935a-9176-57ea-ba68-afe05781da16" } ], "Author":[ @@ -269,18 +269,18 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t expectedExportData := `{` + `"Author":[` + `{` + - `"_docID":"bae-d760e445-22ef-5956-9947-26de226891f6",` + - `"_docIDNew":"bae-e3a6ff01-33ff-55f4-88f9-d13db26274c8",` + - `"book_id":"bae-c821a0a9-7afc-583b-accb-dc99a09c1ff8",` + + `"_docID":"bae-069af8c0-9728-5dde-84ff-ab2dd836f165",` + + `"_docIDNew":"bae-f2e84aeb-decc-5e40-94ff-e365f0ed0f4b",` + + `"book_id":"bae-006376a9-5ceb-5bd0-bfed-6ff5afd3eb93",` + `"name":"John"` + `}` + `],` + `"Book":[` + `{` + - `"_docID":"bae-4059cb15-2b30-5049-b0df-64cc7ad9b5e4",` + + `"_docID":"bae-2b931633-22bf-576f-b788-d8098b213e5a",` + `"_docIDNew":"bae-c821a0a9-7afc-583b-accb-dc99a09c1ff8",` + `"name":"John and the sourcerers' stone",` + - `"reviewedBy_id":"bae-e3a6ff01-33ff-55f4-88f9-d13db26274c8"` + + `"reviewedBy_id":"bae-069af8c0-9728-5dde-84ff-ab2dd836f165"` + `}` + `]` + `}` @@ -308,7 +308,7 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t testUtils.CreateDoc{ NodeID: immutable.Some(0), CollectionID: 1, - // bae-4059cb15-2b30-5049-b0df-64cc7ad9b5e4 + // bae-2b931633-22bf-576f-b788-d8098b213e5a Doc: `{ "name": "John and the sourcerers' stone" }`, @@ -318,7 +318,7 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t CollectionID: 0, Doc: `{ "name": "John", - "book": "bae-4059cb15-2b30-5049-b0df-64cc7ad9b5e4" + "book": "bae-2b931633-22bf-576f-b788-d8098b213e5a" }`, }, testUtils.UpdateDoc{ @@ -326,7 +326,7 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t CollectionID: 1, DocID: 0, Doc: `{ - "reviewedBy_id": "bae-d760e445-22ef-5956-9947-26de226891f6" + "reviewedBy_id": "bae-069af8c0-9728-5dde-84ff-ab2dd836f165" }`, }, /* diff --git a/tests/integration/backup/simple/export_test.go b/tests/integration/backup/simple/export_test.go index d7397b13cb..d4cbb98cbb 100644 --- a/tests/integration/backup/simple/export_test.go +++ b/tests/integration/backup/simple/export_test.go @@ -25,7 +25,7 @@ func TestBackupExport_Simple_NoError(t *testing.T) { Doc: `{"name": "John", "age": 30}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, }, }, } @@ -41,7 +41,7 @@ func TestBackupExport_Empty_NoError(t *testing.T) { Doc: `{}`, }, testUtils.BackupExport{ - ExpectedContent: `{"User":[{"_docID":"bae-524bfa06-849c-5daf-b6df-05c2da80844d","_docIDNew":"bae-524bfa06-849c-5daf-b6df-05c2da80844d"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-0e6d7a02-4b15-5c2b-964f-208708db9ba5","_docIDNew":"bae-0e6d7a02-4b15-5c2b-964f-208708db9ba5"}]}`, }, }, } @@ -98,7 +98,7 @@ func TestBackupExport_JustUserCollection_NoError(t *testing.T) { Config: client.BackupConfig{ Collections: []string{"User"}, }, - ExpectedContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, }, }, } diff --git a/tests/integration/backup/simple/import_test.go b/tests/integration/backup/simple/import_test.go index cdfadc6e61..5d8d4a6ccc 100644 --- a/tests/integration/backup/simple/import_test.go +++ b/tests/integration/backup/simple/import_test.go @@ -20,7 +20,7 @@ func TestBackupImport_Simple_NoError(t *testing.T) { test := testUtils.TestCase{ Actions: []any{ testUtils.BackupImport{ - ImportContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ImportContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, }, testUtils.Request{ Request: ` @@ -60,7 +60,7 @@ func TestBackupImport_WithInvalidCollection_ReturnError(t *testing.T) { test := testUtils.TestCase{ Actions: []any{ testUtils.BackupImport{ - ImportContent: `{"Invalid":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ImportContent: `{"Invalid":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, ExpectedError: "failed to get collection: datastore: key not found. Name: Invalid", }, }, @@ -77,7 +77,7 @@ func TestBackupImport_WithDocAlreadyExists_ReturnError(t *testing.T) { Doc: `{"name": "John", "age": 30}`, }, testUtils.BackupImport{ - ImportContent: `{"User":[{"_docID":"bae-e933420a-988a-56f8-8952-6c245aebd519","_docIDNew":"bae-e933420a-988a-56f8-8952-6c245aebd519","age":30,"name":"John"}]}`, + ImportContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","age":30,"name":"John"}]}`, ExpectedError: "a document with the given ID already exists", }, }, @@ -133,16 +133,16 @@ func TestBackupImport_WithMultipleNoKeys_NoError(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Smith", - "age": int64(31), + "name": "John", + "age": int64(30), }, { "name": "Bob", "age": int64(32), }, { - "name": "John", - "age": int64(30), + "name": "Smith", + "age": int64(31), }, }, }, diff --git a/tests/integration/collection/update/simple/utils.go b/tests/integration/collection/update/simple/utils.go index c5e73f7e97..91cbe700f7 100644 --- a/tests/integration/collection/update/simple/utils.go +++ b/tests/integration/collection/update/simple/utils.go @@ -34,6 +34,9 @@ func init() { if err != nil { panic(err) } + u := c["Users"] + u.Schema.Root = "bafkreiclkqkxhq3xu3sz5fqcixykk2qfpva5asj3elcaqyxscax66ok4za" + c["Users"] = u colDefMap = c } diff --git a/tests/integration/events/simple/with_create_txn_test.go b/tests/integration/events/simple/with_create_txn_test.go index f77a6fe1f6..c60c47bd34 100644 --- a/tests/integration/events/simple/with_create_txn_test.go +++ b/tests/integration/events/simple/with_create_txn_test.go @@ -59,7 +59,7 @@ func TestEventsSimpleWithCreateWithTxnDiscarded(t *testing.T) { }, ExpectedUpdates: []testUtils.ExpectedUpdate{ { - DocID: immutable.Some("bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad"), + DocID: immutable.Some("bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc"), }, // No event should be received for Shahzad, as the transaction was discarded. }, diff --git a/tests/integration/explain/debug/dagscan_test.go b/tests/integration/explain/debug/dagscan_test.go index 010f866dd7..8da73b747f 100644 --- a/tests/integration/explain/debug/dagscan_test.go +++ b/tests/integration/explain/debug/dagscan_test.go @@ -38,7 +38,7 @@ func TestDebugExplainCommitsDagScanQueryOp(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: debug) { - commits (docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", fieldId: "1") { + commits (docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", fieldId: "1") { links { cid } @@ -64,7 +64,7 @@ func TestDebugExplainCommitsDagScanQueryOpWithoutField(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: debug) { - commits (docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3") { + commits (docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84") { links { cid } @@ -90,7 +90,7 @@ func TestDebugExplainLatestCommitsDagScanQueryOp(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: debug) { - latestCommits(docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", fieldId: "1") { + latestCommits(docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", fieldId: "1") { cid links { cid @@ -117,7 +117,7 @@ func TestDebugExplainLatestCommitsDagScanQueryOpWithoutField(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: debug) { - latestCommits(docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3") { + latestCommits(docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84") { cid links { cid diff --git a/tests/integration/explain/default/dagscan_test.go b/tests/integration/explain/default/dagscan_test.go index c18f365f82..321d3c3251 100644 --- a/tests/integration/explain/default/dagscan_test.go +++ b/tests/integration/explain/default/dagscan_test.go @@ -38,7 +38,7 @@ func TestDefaultExplainCommitsDagScanQueryOp(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain { - commits (docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", fieldId: "1") { + commits (docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", fieldId: "1") { links { cid } @@ -56,8 +56,8 @@ func TestDefaultExplainCommitsDagScanQueryOp(t *testing.T) { "fieldId": "1", "spans": []dataMap{ { - "start": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/1", - "end": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/2", + "start": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/1", + "end": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/2", }, }, }, @@ -81,7 +81,7 @@ func TestDefaultExplainCommitsDagScanQueryOpWithoutField(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain { - commits (docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3") { + commits (docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84") { links { cid } @@ -99,8 +99,8 @@ func TestDefaultExplainCommitsDagScanQueryOpWithoutField(t *testing.T) { "fieldId": nil, "spans": []dataMap{ { - "start": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "end": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df4", + "start": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", + "end": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e85", }, }, }, @@ -124,7 +124,7 @@ func TestDefaultExplainLatestCommitsDagScanQueryOp(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain { - latestCommits(docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", fieldId: "1") { + latestCommits(docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", fieldId: "1") { cid links { cid @@ -143,8 +143,8 @@ func TestDefaultExplainLatestCommitsDagScanQueryOp(t *testing.T) { "fieldId": "1", "spans": []dataMap{ { - "start": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/1", - "end": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/2", + "start": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/1", + "end": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/2", }, }, }, @@ -168,7 +168,7 @@ func TestDefaultExplainLatestCommitsDagScanQueryOpWithoutField(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain { - latestCommits(docID: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3") { + latestCommits(docID: "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84") { cid links { cid @@ -187,8 +187,8 @@ func TestDefaultExplainLatestCommitsDagScanQueryOpWithoutField(t *testing.T) { "fieldId": "C", "spans": []dataMap{ { - "start": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/C", - "end": "/bae-41598f0c-19bc-5da6-813b-e80f14a10df3/D", + "start": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/C", + "end": "/bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84/D", }, }, }, diff --git a/tests/integration/explain/execute/dagscan_test.go b/tests/integration/explain/execute/dagscan_test.go index 3edc6e71f0..524e2a1204 100644 --- a/tests/integration/explain/execute/dagscan_test.go +++ b/tests/integration/explain/execute/dagscan_test.go @@ -30,7 +30,7 @@ func TestExecuteExplainCommitsDagScan(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: execute) { - commits (docID: "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138") { + commits (docID: "bae-dcdbc1dc-8428-592d-ad9d-ca0f1430e1bf") { links { cid } @@ -75,7 +75,7 @@ func TestExecuteExplainLatestCommitsDagScan(t *testing.T) { testUtils.ExplainRequest{ Request: `query @explain(type: execute) { - latestCommits(docID: "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138") { + latestCommits(docID: "bae-dcdbc1dc-8428-592d-ad9d-ca0f1430e1bf") { cid links { cid diff --git a/tests/integration/explain/execute/delete_test.go b/tests/integration/explain/execute/delete_test.go index 75aa515c1a..99edd857a3 100644 --- a/tests/integration/explain/execute/delete_test.go +++ b/tests/integration/explain/execute/delete_test.go @@ -30,7 +30,7 @@ func TestExecuteExplainMutationRequestWithDeleteUsingID(t *testing.T) { testUtils.ExplainRequest{ Request: `mutation @explain(type: execute) { - delete_ContactAddress(docIDs: ["bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692"]) { + delete_ContactAddress(docIDs: ["bae-49f715e7-7f01-5509-a213-ed98cb81583f"]) { city } }`, diff --git a/tests/integration/explain/execute/fixture.go b/tests/integration/explain/execute/fixture.go index 7de5e6a959..17a172552f 100644 --- a/tests/integration/explain/execute/fixture.go +++ b/tests/integration/explain/execute/fixture.go @@ -20,28 +20,27 @@ func create3ArticleDocuments() []testUtils.CreateDoc { return []testUtils.CreateDoc{ { CollectionID: 0, - Doc: `{ - - "name": "After Guantánamo, Another Injustice", - "pages": 100, - "author_id": "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138" - }`, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "pages": 100, + "author_id": testUtils.NewDocIndex(2, 0), + }, }, { CollectionID: 0, - Doc: `{ - "name": "To my dear readers", - "pages": 200, - "author_id": "bae-68cb395d-df73-5bcb-b623-615a140dee12" - }`, + DocMap: map[string]any{ + "name": "To my dear readers", + "pages": 200, + "author_id": testUtils.NewDocIndex(2, 1), + }, }, { CollectionID: 0, - Doc: `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "pages": 300, - "author_id": "bae-68cb395d-df73-5bcb-b623-615a140dee12" - }`, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "pages": 300, + "author_id": testUtils.NewDocIndex(2, 1), + }, }, } } @@ -50,29 +49,29 @@ func create3BookDocuments() []testUtils.CreateDoc { return []testUtils.CreateDoc{ { CollectionID: 1, - Doc: `{ - "name": "Painted House", - "pages": 78, - "chapterPages": [1, 22, 33, 44, 55, 66], - "author_id": "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "pages": 78, + "chapterPages": []int64{1, 22, 33, 44, 55, 66}, + "author_id": testUtils.NewDocIndex(2, 0), + }, }, { CollectionID: 1, - Doc: `{ - "name": "A Time for Mercy", - "pages": 333, - "chapterPages": [0, 22, 101, 321], - "author_id": "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138" - }`, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "pages": 333, + "chapterPages": []int64{0, 22, 101, 321}, + "author_id": testUtils.NewDocIndex(2, 0), + }, }, { CollectionID: 1, - Doc: `{ - "name": "Theif Lord", - "pages": 20, - "author_id": "bae-68cb395d-df73-5bcb-b623-615a140dee12" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "pages": 20, + "author_id": testUtils.NewDocIndex(2, 1), + }, }, } } @@ -86,7 +85,7 @@ func create2AuthorDocuments() []testUtils.CreateDoc { "name": "John Grisham", "age": 65, "verified": true, - "contact_id": "bae-4db5359b-7dbe-5778-b96f-d71d1e6d0871" + "contact_id": "bae-819c9c03-9d49-5fd5-aaee-0dc5a70bbe44" }`, }, { @@ -96,7 +95,7 @@ func create2AuthorDocuments() []testUtils.CreateDoc { "name": "Cornelia Funke", "age": 62, "verified": false, - "contact_id": "bae-1f19fc5d-de4d-59a5-bbde-492be1757d65" + "contact_id": "bae-9bf0272a-c521-5bef-a7ba-642e8be6e433" }`, }, } @@ -107,21 +106,21 @@ func create2AuthorContactDocuments() []testUtils.CreateDoc { { CollectionID: 3, // "author_id": "bae-7f54d9e0-cbde-5320-aa6c-5c8895a89138" - // _docID: "bae-4db5359b-7dbe-5778-b96f-d71d1e6d0871" + // _docID: "bae-819c9c03-9d49-5fd5-aaee-0dc5a70bbe44" Doc: `{ "cell": "5197212301", "email": "john_grisham@example.com", - "address_id": "bae-c8448e47-6cd1-571f-90bd-364acb80da7b" + "address_id": "bae-14f20db7-3654-58de-9156-596ef2cfd790" }`, }, { CollectionID: 3, // "author_id": "bae-68cb395d-df73-5bcb-b623-615a140dee12", - // _docID: "bae-1f19fc5d-de4d-59a5-bbde-492be1757d65" + // _docID: "bae-9bf0272a-c521-5bef-a7ba-642e8be6e433" Doc: `{ "cell": "5197212302", "email": "cornelia_funke@example.com", - "address_id": "bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692" + "address_id": "bae-49f715e7-7f01-5509-a213-ed98cb81583f" }`, }, } @@ -131,8 +130,7 @@ func create2AddressDocuments() []testUtils.CreateDoc { return []testUtils.CreateDoc{ { CollectionID: 4, - // "contact_id": "bae-4db5359b-7dbe-5778-b96f-d71d1e6d0871" - // _docID: bae-c8448e47-6cd1-571f-90bd-364acb80da7b + // _docID: bae-14f20db7-3654-58de-9156-596ef2cfd790 Doc: `{ "city": "Waterloo", "country": "Canada" @@ -140,8 +138,7 @@ func create2AddressDocuments() []testUtils.CreateDoc { }, { CollectionID: 4, - // "contact_id": ""bae-1f19fc5d-de4d-59a5-bbde-492be1757d65"" - // _docID: bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692 + // _docID: bae-49f715e7-7f01-5509-a213-ed98cb81583f Doc: `{ "city": "Brampton", "country": "Canada" diff --git a/tests/integration/explain/execute/query_deleted_docs_test.go b/tests/integration/explain/execute/query_deleted_docs_test.go index 7872eb4847..77a3b3708a 100644 --- a/tests/integration/explain/execute/query_deleted_docs_test.go +++ b/tests/integration/explain/execute/query_deleted_docs_test.go @@ -26,12 +26,12 @@ func TestExecuteExplainQueryDeletedDocs(t *testing.T) { create2AddressDocuments(), testUtils.Request{ Request: `mutation { - delete_ContactAddress(docIDs: ["bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692"]) { + delete_ContactAddress(docIDs: ["bae-49f715e7-7f01-5509-a213-ed98cb81583f"]) { _docID } }`, Results: []map[string]any{ - {"_docID": "bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692"}, + {"_docID": "bae-49f715e7-7f01-5509-a213-ed98cb81583f"}, }, }, testUtils.ExplainRequest{ diff --git a/tests/integration/explain/execute/type_join_test.go b/tests/integration/explain/execute/type_join_test.go index eb1e187485..ab89890f02 100644 --- a/tests/integration/explain/execute/type_join_test.go +++ b/tests/integration/explain/execute/type_join_test.go @@ -170,14 +170,9 @@ func TestExecuteExplainWithTwoLevelDeepNestedJoins(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - // Authors - create2AuthorDocuments(), - - // Contacts - create2AuthorContactDocuments(), - - // Addresses create2AddressDocuments(), + create2AuthorContactDocuments(), + create2AuthorDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { diff --git a/tests/integration/explain/execute/update_test.go b/tests/integration/explain/execute/update_test.go index 4f7a262136..0eaf8cbb22 100644 --- a/tests/integration/explain/execute/update_test.go +++ b/tests/integration/explain/execute/update_test.go @@ -32,8 +32,8 @@ func TestExecuteExplainMutationRequestWithUpdateUsingIDs(t *testing.T) { Request: `mutation @explain(type: execute) { update_ContactAddress( docIDs: [ - "bae-c8448e47-6cd1-571f-90bd-364acb80da7b", - "bae-f01bf83f-1507-5fb5-a6a3-09ecffa3c692" + "bae-14f20db7-3654-58de-9156-596ef2cfd790", + "bae-49f715e7-7f01-5509-a213-ed98cb81583f" ], input: {country: "USA"} ) { diff --git a/tests/integration/explain/execute/with_average_test.go b/tests/integration/explain/execute/with_average_test.go index 9e906c475d..33a238eb68 100644 --- a/tests/integration/explain/execute/with_average_test.go +++ b/tests/integration/explain/execute/with_average_test.go @@ -24,8 +24,7 @@ func TestExecuteExplainAverageRequestOnArrayField(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - - // Books + create2AuthorDocuments(), create3BookDocuments(), testUtils.ExplainRequest{ @@ -80,12 +79,8 @@ func TestExplainExplainAverageRequestOnJoinedField(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - - // Books - create3BookDocuments(), - - // Authors create2AuthorDocuments(), + create3BookDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { diff --git a/tests/integration/explain/execute/with_count_test.go b/tests/integration/explain/execute/with_count_test.go index 43ff3d13df..23858e49d2 100644 --- a/tests/integration/explain/execute/with_count_test.go +++ b/tests/integration/explain/execute/with_count_test.go @@ -25,11 +25,8 @@ func TestExecuteExplainRequestWithCountOnOneToManyRelation(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - // Books - create3BookDocuments(), - - // Authors create2AuthorDocuments(), + create3BookDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { diff --git a/tests/integration/explain/execute/with_limit_test.go b/tests/integration/explain/execute/with_limit_test.go index 88a1666ca3..cc703c9082 100644 --- a/tests/integration/explain/execute/with_limit_test.go +++ b/tests/integration/explain/execute/with_limit_test.go @@ -24,8 +24,7 @@ func TestExecuteExplainRequestWithBothLimitAndOffsetOnParent(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - - // Books + create2AuthorDocuments(), create3BookDocuments(), testUtils.ExplainRequest{ @@ -74,11 +73,8 @@ func TestExecuteExplainRequestWithBothLimitAndOffsetOnParentAndLimitOnChild(t *t Actions: []any{ explainUtils.SchemaForExplainTests, - // Articles - create3ArticleDocuments(), - - // Authors create2AuthorDocuments(), + create3ArticleDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { @@ -112,8 +108,8 @@ func TestExecuteExplainRequestWithBothLimitAndOffsetOnParentAndLimitOnChild(t *t }, "subTypeScanNode": dataMap{ "iterations": uint64(2), - "docFetches": uint64(4), - "fieldFetches": uint64(6), + "docFetches": uint64(3), + "fieldFetches": uint64(5), "indexFetches": uint64(0), }, }, diff --git a/tests/integration/explain/execute/with_order_test.go b/tests/integration/explain/execute/with_order_test.go index 9155523b20..a2441b9cd5 100644 --- a/tests/integration/explain/execute/with_order_test.go +++ b/tests/integration/explain/execute/with_order_test.go @@ -159,11 +159,8 @@ func TestExecuteExplainRequestWithOrderFieldOnChild(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - // Articles - create3ArticleDocuments(), - - // Authors create2AuthorDocuments(), + create3ArticleDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { @@ -220,11 +217,8 @@ func TestExecuteExplainRequestWithOrderFieldOnBothParentAndChild(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - // Articles - create3ArticleDocuments(), - - // Authors create2AuthorDocuments(), + create3ArticleDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { @@ -285,11 +279,8 @@ func TestExecuteExplainRequestWhereParentFieldIsOrderedByChildField(t *testing.T Actions: []any{ explainUtils.SchemaForExplainTests, - // Articles - create3ArticleDocuments(), - - // Authors create2AuthorDocuments(), + create3ArticleDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { diff --git a/tests/integration/explain/execute/with_sum_test.go b/tests/integration/explain/execute/with_sum_test.go index c37e3d0309..e9e3462045 100644 --- a/tests/integration/explain/execute/with_sum_test.go +++ b/tests/integration/explain/execute/with_sum_test.go @@ -24,8 +24,7 @@ func TestExecuteExplainRequestWithSumOfInlineArrayField(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - - // Books + create2AuthorDocuments(), create3BookDocuments(), testUtils.ExplainRequest{ @@ -74,12 +73,8 @@ func TestExecuteExplainRequestSumOfRelatedOneToManyField(t *testing.T) { Actions: []any{ explainUtils.SchemaForExplainTests, - - // Articles - create3ArticleDocuments(), - - // Authors create2AuthorDocuments(), + create3ArticleDocuments(), testUtils.ExplainRequest{ Request: `query @explain(type: execute) { diff --git a/tests/integration/index/create_drop_test.go b/tests/integration/index/create_drop_test.go index 0680ea7aed..a9e55f0322 100644 --- a/tests/integration/index/create_drop_test.go +++ b/tests/integration/index/create_drop_test.go @@ -30,7 +30,7 @@ func TestIndexDrop_ShouldNotHinderQuerying(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 Doc: ` { "name": "John", diff --git a/tests/integration/index/create_test.go b/tests/integration/index/create_test.go index d37dfd07f7..9afb8ea333 100644 --- a/tests/integration/index/create_test.go +++ b/tests/integration/index/create_test.go @@ -31,7 +31,7 @@ func TestIndexCreateWithCollection_ShouldNotHinderQuerying(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 Doc: ` { "name": "John", @@ -73,7 +73,7 @@ func TestIndexCreate_ShouldNotHinderQuerying(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 Doc: ` { "name": "John", diff --git a/tests/integration/index/create_unique_composite_test.go b/tests/integration/index/create_unique_composite_test.go index f115668068..9adb6d2e67 100644 --- a/tests/integration/index/create_unique_composite_test.go +++ b/tests/integration/index/create_unique_composite_test.go @@ -55,7 +55,7 @@ func TestCreateUniqueCompositeIndex_IfFieldValuesAreNotUnique_ReturnError(t *tes Fields: []testUtils.IndexedField{{Name: "name"}, {Name: "age"}}, Unique: true, ExpectedError: db.NewErrCanNotIndexNonUniqueFields( - "bae-cae3deac-d371-5a1f-93b4-ede69042f79b", + "bae-c20024f0-bd72-56c2-85d5-865d3aa270b7", errors.NewKV("name", "John"), errors.NewKV("age", 21), ).Error(), }, @@ -100,7 +100,7 @@ func TestUniqueCompositeIndexCreate_UponAddingDocWithExistingFieldValue_ReturnEr "email": "another@gmail.com" }`, ExpectedError: db.NewErrCanNotIndexNonUniqueFields( - "bae-13254430-7e9e-52e2-9861-9a7ec7a75c8d", + "bae-4da27b71-f735-59f6-b6b8-ea0fa181e3e3", errors.NewKV("name", "John"), errors.NewKV("age", 21)).Error(), }, }, diff --git a/tests/integration/index/create_unique_test.go b/tests/integration/index/create_unique_test.go index 3d723f5d55..36488ecaab 100644 --- a/tests/integration/index/create_unique_test.go +++ b/tests/integration/index/create_unique_test.go @@ -19,7 +19,7 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -const johnDocID = "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7" +const johnDocID = "bae-774fbeea-813b-52c8-82b0-d08515a075d7" func TestCreateUniqueIndex_IfFieldValuesAreNotUnique_ReturnError(t *testing.T) { test := testUtils.TestCase{ diff --git a/tests/integration/index/drop_test.go b/tests/integration/index/drop_test.go index 96e136c332..4639bfa756 100644 --- a/tests/integration/index/drop_test.go +++ b/tests/integration/index/drop_test.go @@ -30,7 +30,7 @@ func TestIndexDrop_IfIndexDoesNotExist_ReturnError(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 Doc: ` { "name": "John", diff --git a/tests/integration/index/query_with_composite_index_only_filter_test.go b/tests/integration/index/query_with_composite_index_only_filter_test.go index bf7e8b17c3..ccb2a43e66 100644 --- a/tests/integration/index/query_with_composite_index_only_filter_test.go +++ b/tests/integration/index/query_with_composite_index_only_filter_test.go @@ -909,8 +909,8 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( Request: reqWithName, Results: []map[string]any{ {"about": "bob3"}, - {"about": "bob1"}, {"about": "bob2"}, + {"about": "bob1"}, {"about": "bob4"}, }, }, @@ -922,8 +922,8 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( Request: reqWithNameAge, Results: []map[string]any{ {"about": "bob3"}, - {"about": "bob1"}, {"about": "bob2"}, + {"about": "bob1"}, }, }, testUtils.Request{ @@ -933,8 +933,8 @@ func TestQueryWithCompositeIndex_IfConsecutiveEqOps_ShouldUseAllToOptimizeQuery( testUtils.Request{ Request: reqWithNameAgeNumChildren, Results: []map[string]any{ - {"about": "bob1"}, {"about": "bob2"}, + {"about": "bob1"}, }, }, testUtils.Request{ diff --git a/tests/integration/index/query_with_compound_filter_relation_test.go b/tests/integration/index/query_with_compound_filter_relation_test.go index 31667d8bc7..8f74411536 100644 --- a/tests/integration/index/query_with_compound_filter_relation_test.go +++ b/tests/integration/index/query_with_compound_filter_relation_test.go @@ -189,10 +189,10 @@ func TestIndex_QueryWithIndexOnOneToManyRelationAndFilter_Data(t *testing.T) { }`, Results: []map[string]any{ { - "name": "DefraDB", + "name": "LensVM", }, { - "name": "LensVM", + "name": "DefraDB", }, }, }, @@ -274,10 +274,10 @@ func TestIndex_QueryWithIndexOnOneToManyRelationOrFilter_Data(t *testing.T) { "name": "Zanzi", }, { - "name": "DefraDB", + "name": "LensVM", }, { - "name": "LensVM", + "name": "DefraDB", }, }, }, @@ -348,10 +348,10 @@ func TestIndex_QueryWithIndexOnOneToManyRelationNotFilter_Data(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Horizon", + "name": "Zanzi", }, { - "name": "Zanzi", + "name": "Horizon", }, }, }, diff --git a/tests/integration/index/query_with_relation_filter_test.go b/tests/integration/index/query_with_relation_filter_test.go index 94160a5e3c..ef4ec989ca 100644 --- a/tests/integration/index/query_with_relation_filter_test.go +++ b/tests/integration/index/query_with_relation_filter_test.go @@ -194,8 +194,8 @@ func TestQueryWithIndexOnOneToOnesSecondaryRelation_IfFilterOnIndexedRelation_Sh Request: req2, Results: []map[string]any{ {"name": "Shahzad"}, - {"name": "Fred"}, {"name": "John"}, + {"name": "Fred"}, }, }, testUtils.Request{ @@ -261,9 +261,9 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio testUtils.Request{ Request: req2, Results: []map[string]any{ + {"name": "Shahzad"}, {"name": "John"}, {"name": "Fred"}, - {"name": "Shahzad"}, }, }, testUtils.Request{ @@ -332,9 +332,9 @@ func TestQueryWithIndexOnOneToOnePrimaryRelation_IfFilterOnIndexedFieldOfRelatio testUtils.Request{ Request: req2, Results: []map[string]any{ + {"name": "Shahzad"}, {"name": "John"}, {"name": "Fred"}, - {"name": "Shahzad"}, }, }, testUtils.Request{ @@ -427,27 +427,27 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilter(t *tes }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Walkman", + DocMap: map[string]any{ + "model": "Walkman", "manufacturer": "Sony", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Walkman", + DocMap: map[string]any{ + "model": "Walkman", "manufacturer": "The Proclaimers", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Running Man", + DocMap: map[string]any{ + "model": "Running Man", "manufacturer": "Braveworld Productions", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -467,11 +467,11 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilter(t *tes "devices": []map[string]any{ { "model": "Walkman", - "manufacturer": "Sony", + "manufacturer": "The Proclaimers", }, { "model": "Walkman", - "manufacturer": "The Proclaimers", + "manufacturer": "Sony", }, // The filter is on User, so all devices belonging to it will be returned { @@ -525,27 +525,27 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilterWithExp }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Walkman", + DocMap: map[string]any{ + "model": "Walkman", "manufacturer": "Sony", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Walkman", + DocMap: map[string]any{ + "model": "Walkman", "manufacturer": "The Proclaimers", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Running Man", + DocMap: map[string]any{ + "model": "Running Man", "manufacturer": "Braveworld Productions", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: req, @@ -555,11 +555,11 @@ func TestQueryWithIndexOnOneToMany_IfFilterOnIndexedRelation_ShouldFilterWithExp "devices": []map[string]any{ { "model": "Walkman", - "manufacturer": "Sony", + "manufacturer": "The Proclaimers", }, { "model": "Walkman", - "manufacturer": "The Proclaimers", + "manufacturer": "Sony", }, { "model": "Running Man", @@ -670,19 +670,19 @@ func TestQueryWithIndexOnManyToOne_IfFilterOnIndexedField_ShouldFilterWithExplai { "model": "Playstation 5", "owner": map[string]any{ - "name": "Islam", + "name": "Addo", }, }, { - "model": "Playstation 5", + "model": "iPhone 10", "owner": map[string]any{ "name": "Addo", }, }, { - "model": "iPhone 10", + "model": "Playstation 5", "owner": map[string]any{ - "name": "Addo", + "name": "Islam", }, }, }, @@ -732,9 +732,9 @@ func TestQueryWithIndexOnManyToOne_IfFilterOnIndexedRelation_ShouldFilterWithExp testUtils.Request{ Request: req, Results: []map[string]any{ - {"model": "iPhone 13"}, - {"model": "iPad Mini"}, {"model": "MacBook Pro"}, + {"model": "iPad Mini"}, + {"model": "iPhone 13"}, }, }, testUtils.Request{ @@ -783,19 +783,19 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_NeNilFilterShouldUseIn }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "Walkman", + DocMap: map[string]any{ + "model": "Walkman", "manufacturer": "Sony", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "model": "iPhone", + DocMap: map[string]any{ + "model": "iPhone", "manufacturer": "Apple", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" - }`, + "owner": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, @@ -814,8 +814,8 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_NeNilFilterShouldUseIn testUtils.Request{ Request: req, Results: []map[string]any{ - {"model": "iPhone"}, {"model": "Walkman"}, + {"model": "iPhone"}, }, }, testUtils.Request{ @@ -867,7 +867,7 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_EqNilFilterShouldUseIn Doc: `{ "model": "Walkman", "manufacturer": "Sony", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" + "owner": "bae-5622129c-b893-5768-a3f4-8f745db4cc04" }`, }, testUtils.CreateDoc{ @@ -875,7 +875,7 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_EqNilFilterShouldUseIn Doc: `{ "model": "iPhone", "manufacturer": "Apple", - "owner": "bae-403d7337-f73e-5c81-8719-e853938c8985" + "owner": "bae-5622129c-b893-5768-a3f4-8f745db4cc04" }`, }, testUtils.CreateDoc{ @@ -895,8 +895,8 @@ func TestQueryWithIndexOnOneToMany_IfIndexedRelationIsNil_EqNilFilterShouldUseIn testUtils.Request{ Request: req, Results: []map[string]any{ - {"model": "Running Man"}, {"model": "PlayStation 5"}, + {"model": "Running Man"}, }, }, testUtils.Request{ diff --git a/tests/integration/index/query_with_unique_composite_index_filter_test.go b/tests/integration/index/query_with_unique_composite_index_filter_test.go index 52712bc181..26f35a0165 100644 --- a/tests/integration/index/query_with_unique_composite_index_filter_test.go +++ b/tests/integration/index/query_with_unique_composite_index_filter_test.go @@ -1037,8 +1037,8 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnSecondFieldsAndNilFilter testUtils.Request{ Request: req, Results: []map[string]any{ - {"name": "Bob", "age": nil, "email": "bob2@gmail.com"}, {"name": "Bob", "age": nil, "email": "bob1@gmail.com"}, + {"name": "Bob", "age": nil, "email": "bob2@gmail.com"}, }, }, testUtils.Request{ @@ -1135,8 +1135,8 @@ func TestQueryWithUniqueCompositeIndex_WithMultipleNilOnBothFieldsAndNilFilter_S } }`, Results: []map[string]any{ - {"about": "nil_nil_2"}, {"about": "bob_nil"}, + {"about": "nil_nil_2"}, {"about": "nil_nil_1"}, }, }, @@ -1269,10 +1269,10 @@ func TestQueryWithUniqueCompositeIndex_AfterUpdateOnNilFields_ShouldFetch(t *tes } }`, Results: []map[string]any{ - {"about": "bob_nil -> nil_nil"}, - {"about": "nil_nil -> bob_nil"}, {"about": "bob_22 -> bob_nil"}, {"about": "nil_22 -> bob_nil"}, + {"about": "bob_nil -> nil_nil"}, + {"about": "nil_nil -> bob_nil"}, }, }, }, diff --git a/tests/integration/index/query_with_unique_index_only_filter_test.go b/tests/integration/index/query_with_unique_index_only_filter_test.go index 23563335d4..f21de4630c 100644 --- a/tests/integration/index/query_with_unique_index_only_filter_test.go +++ b/tests/integration/index/query_with_unique_index_only_filter_test.go @@ -727,8 +727,8 @@ func TestQueryWithUniqueIndex_WithMultipleNilValuesAndEqualFilter_ShouldFetch(t } }`, Results: []map[string]any{ - {"name": "Bob"}, {"name": "Alice"}, + {"name": "Bob"}, }, }, }, diff --git a/tests/integration/mutation/create/crdt/pcounter_test.go b/tests/integration/mutation/create/crdt/pcounter_test.go index 681ca2ec76..e54dba4ea6 100644 --- a/tests/integration/mutation/create/crdt/pcounter_test.go +++ b/tests/integration/mutation/create/crdt/pcounter_test.go @@ -44,7 +44,7 @@ func TestPCounterCreate_IntKindWithPositiveValue_NoError(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-a688789e-d8a6-57a7-be09-22e005ab79e0", + "_docID": "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d", "name": "John", "points": int64(10), }, diff --git a/tests/integration/mutation/create/crdt/pncounter_test.go b/tests/integration/mutation/create/crdt/pncounter_test.go index 2d445bff80..b8808ff40a 100644 --- a/tests/integration/mutation/create/crdt/pncounter_test.go +++ b/tests/integration/mutation/create/crdt/pncounter_test.go @@ -44,7 +44,7 @@ func TestPNCounterCreate_IntKindWithPositiveValue_NoError(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-a688789e-d8a6-57a7-be09-22e005ab79e0", + "_docID": "bae-bc5464e4-26a6-5307-b516-aada0abeb089", "name": "John", "points": int64(10), }, diff --git a/tests/integration/mutation/create/field_kinds/field_kind_json_test.go b/tests/integration/mutation/create/field_kinds/field_kind_json_test.go index 69b1075464..8833a74b31 100644 --- a/tests/integration/mutation/create/field_kinds/field_kind_json_test.go +++ b/tests/integration/mutation/create/field_kinds/field_kind_json_test.go @@ -38,7 +38,7 @@ func TestMutationCreate_WithJSONFieldGivenValidJSON_NoError(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-b2dff82c-ab26-5d06-a29a-02aa4807dde2", + "_docID": "bae-84ae4ef8-ca0c-5f32-bc85-cee97e731bc0", "custom": "{\"tree\":\"maple\",\"age\":250}", "name": "John", }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go b/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go index 43275f8404..3bddea1a4a 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_many/with_alias_test.go @@ -31,7 +31,7 @@ func TestMutationCreateOneToMany_AliasedRelationNameWithInvalidField_Error(t *te testUtils.CreateDoc{ Doc: `{ "notName": "Painted House", - "author": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: notName", }, @@ -54,7 +54,7 @@ func TestMutationCreateOneToMany_AliasedRelationNameNonExistingRelationSingleSid CollectionID: 0, Doc: `{ "name": "John Grisham", - "published": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: published", }, @@ -73,7 +73,7 @@ func TestMutationCreateOneToMany_AliasedRelationNameNonExistingRelationManySide_ CollectionID: 0, Doc: `{ "name": "Painted House", - "author": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ @@ -183,7 +183,7 @@ func TestMutationCreateOneToMany_AliasedRelationNameToLinkFromManySide(t *testin func TestMutationUpdateOneToMany_AliasRelationNameAndInternalIDBothProduceSameDocID(t *testing.T) { // These IDs MUST be shared by both tests below. - bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" + bookID := "bae-e4888569-d423-58b7-94c5-5886e3cffe22" nonAliasedTest := testUtils.TestCase{ Description: "One to many update mutation using relation alias name from single side (wrong)", diff --git a/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go b/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go index 3d15e52323..56efed2216 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_many/with_simple_test.go @@ -31,7 +31,7 @@ func TestMutationCreateOneToMany_WithInvalidField_Error(t *testing.T) { testUtils.CreateDoc{ Doc: `{ "notName": "Painted House", - "author_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: notName", }, @@ -54,7 +54,7 @@ func TestMutationCreateOneToMany_NonExistingRelationSingleSide_NoIDFieldError(t CollectionID: 0, Doc: `{ "name": "John Grisham", - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: published_id", }, @@ -73,7 +73,7 @@ func TestMutationCreateOneToMany_NonExistingRelationManySide_CreatedDoc(t *testi CollectionID: 0, Doc: `{ "name": "Painted House", - "author_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ diff --git a/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go b/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go index 16da55ce78..ef263bd47e 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one/with_alias_test.go @@ -11,7 +11,6 @@ package one_to_one import ( - "fmt" "testing" "github.com/sourcenetwork/immutable" @@ -33,7 +32,7 @@ func TestMutationCreateOneToOne_UseAliasWithInvalidField_Error(t *testing.T) { CollectionID: 1, Doc: `{ "notName": "John Grisham", - "published": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: notName", }, @@ -52,7 +51,7 @@ func TestMutationCreateOneToOne_UseAliasWithNonExistingRelationPrimarySide_Creat CollectionID: 1, Doc: `{ "name": "John Grisham", - "published": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ @@ -80,7 +79,7 @@ func TestMutationCreateOneToOne_UseAliasWithNonExistingRelationSecondarySide_Err CollectionID: 0, Doc: `{ "name": "Painted House", - "author": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "document not found or not authorized to access", }, @@ -90,8 +89,6 @@ func TestMutationCreateOneToOne_UseAliasWithNonExistingRelationSecondarySide_Err } func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromPrimarySide(t *testing.T) { - bookID := "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - test := testUtils.TestCase{ Description: "One to one create mutation with an alias relation.", Actions: []any{ @@ -103,13 +100,10 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromPrimarySid }, testUtils.CreateDoc{ CollectionID: 1, - Doc: fmt.Sprintf( - `{ - "name": "John Grisham", - "published": "%s" - }`, - bookID, - ), + DocMap: map[string]any{ + "name": "John Grisham", + "published": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -154,8 +148,6 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromPrimarySid } func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromSecondarySide(t *testing.T) { - authorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - test := testUtils.TestCase{ Description: "One to one create mutation from secondary side with alias relation.", Actions: []any{ @@ -167,13 +159,10 @@ func TestMutationCreateOneToOne_UseAliasedRelationNameToLink_QueryFromSecondaryS }, testUtils.CreateDoc{ CollectionID: 0, - Doc: fmt.Sprintf( - `{ - "name": "Painted House", - "author": "%s" - }`, - authorID, - ), + DocMap: map[string]any{ + "name": "Painted House", + "author": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go b/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go index c693b05187..fa890f8e70 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one/with_simple_test.go @@ -11,7 +11,6 @@ package one_to_one import ( - "fmt" "testing" testUtils "github.com/sourcenetwork/defradb/tests/integration" @@ -33,7 +32,7 @@ func TestMutationCreateOneToOne_WithInvalidField_Error(t *testing.T) { CollectionID: 1, Doc: `{ "notName": "John Grisham", - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "The given field does not exist. Name: notName", }, @@ -52,7 +51,7 @@ func TestMutationCreateOneToOneNoChild(t *testing.T) { CollectionID: 1, Doc: `{ "name": "John Grisham", - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ @@ -80,7 +79,7 @@ func TestMutationCreateOneToOne_NonExistingRelationSecondarySide_Error(t *testin CollectionID: 0, Doc: `{ "name": "Painted House", - "author_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "author_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, ExpectedError: "document not found or not authorized to access", }, @@ -90,8 +89,6 @@ func TestMutationCreateOneToOne_NonExistingRelationSecondarySide_Error(t *testin } func TestMutationCreateOneToOne(t *testing.T) { - bookID := "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - test := testUtils.TestCase{ Description: "One to one create mutation", Actions: []any{ @@ -103,13 +100,10 @@ func TestMutationCreateOneToOne(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: fmt.Sprintf( - `{ - "name": "John Grisham", - "published_id": "%s" - }`, - bookID, - ), + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` @@ -156,8 +150,6 @@ func TestMutationCreateOneToOne(t *testing.T) { } func TestMutationCreateOneToOneSecondarySide(t *testing.T) { - authorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - test := testUtils.TestCase{ Description: "One to one create mutation from secondary side", Actions: []any{ @@ -169,13 +161,10 @@ func TestMutationCreateOneToOneSecondarySide(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - Doc: fmt.Sprintf( - `{ - "name": "Painted House", - "author_id": "%s" - }`, - authorID, - ), + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: ` @@ -222,8 +211,6 @@ func TestMutationCreateOneToOneSecondarySide(t *testing.T) { } func TestMutationCreateOneToOne_ErrorsGivenRelationAlreadyEstablishedViaPrimary(t *testing.T) { - bookID := "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - test := testUtils.TestCase{ Description: "One to one create mutation, errors due to link already existing, primary side", Actions: []any{ @@ -235,21 +222,17 @@ func TestMutationCreateOneToOne_ErrorsGivenRelationAlreadyEstablishedViaPrimary( }, testUtils.CreateDoc{ CollectionID: 1, - Doc: fmt.Sprintf(`{ - "name": "John Grisham", - "published_id": "%s" - }`, - bookID, - ), + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: fmt.Sprintf(`{ - "name": "Saadi Shirazi", - "published_id": "%s" - }`, - bookID, - ), + DocMap: map[string]any{ + "name": "Saadi Shirazi", + "published_id": testUtils.NewDocIndex(0, 0), + }, ExpectedError: "target document is already linked to another document.", }, }, @@ -259,8 +242,6 @@ func TestMutationCreateOneToOne_ErrorsGivenRelationAlreadyEstablishedViaPrimary( } func TestMutationCreateOneToOne_ErrorsGivenRelationAlreadyEstablishedViaSecondary(t *testing.T) { - authorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - test := testUtils.TestCase{ Description: "One to one create mutation, errors due to link already existing, secondary side", Actions: []any{ @@ -272,21 +253,17 @@ func TestMutationCreateOneToOne_ErrorsGivenRelationAlreadyEstablishedViaSecondar }, testUtils.CreateDoc{ CollectionID: 0, - Doc: fmt.Sprintf(`{ - "name": "Painted House", - "author_id": "%s" - }`, - authorID, - ), + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 0, - Doc: fmt.Sprintf(`{ - "name": "Golestan", - "author_id": "%s" - }`, - authorID, - ), + DocMap: map[string]any{ + "name": "Golestan", + "author_id": testUtils.NewDocIndex(1, 0), + }, ExpectedError: "target document is already linked to another document.", }, }, diff --git a/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go b/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go index 64272779d3..3b40c19f6c 100644 --- a/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go +++ b/tests/integration/mutation/create/field_kinds/one_to_one_to_one/with_txn_test.go @@ -24,7 +24,7 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. Actions: []any{ testUtils.CreateDoc{ CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -32,7 +32,7 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. }, testUtils.CreateDoc{ CollectionID: 2, - // "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + // "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", Doc: `{ "name": "Online", "address": "Manning Early Access Program (MEAP)" @@ -42,26 +42,26 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. testUtils.Request{ TransactionID: immutable.Some(0), Request: `mutation { - create_Book(input: {name: "Book By Website", rating: 4.0, publisher_id: "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4"}) { + create_Book(input: {name: "Book By Website", rating: 4.0, publisher_id: "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed"}) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, testUtils.Request{ TransactionID: immutable.Some(1), Request: `mutation { - create_Book(input: {name: "Book By Online", rating: 4.0, publisher_id: "bae-8a381044-9206-51e7-8bc8-dc683d5f2523"}) { + create_Book(input: {name: "Book By Online", rating: 4.0, publisher_id: "bae-21084f46-b12a-53ab-94dd-04d075b4218c"}) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", }, }, }, @@ -80,16 +80,16 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": map[string]any{ - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", "name": "Book By Website", }, }, { - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", "name": "Online", "published": nil, }, @@ -110,16 +110,15 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": nil, }, - { - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", "name": "Online", "published": map[string]any{ - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", "name": "Book By Online", }, }, @@ -146,20 +145,19 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsForward(t *testing. }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", - "name": "Book By Website", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", + "name": "Book By Online", "publisher": map[string]any{ - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", - "name": "Website", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", + "name": "Online", }, }, - { - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", - "name": "Book By Online", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", + "name": "Book By Website", "publisher": map[string]any{ - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", - "name": "Online", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", + "name": "Website", }, }, }, @@ -176,7 +174,7 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing Actions: []any{ testUtils.CreateDoc{ CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -184,7 +182,7 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing }, testUtils.CreateDoc{ CollectionID: 2, - // "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + // "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", Doc: `{ "name": "Online", "address": "Manning Early Access Program (MEAP)" @@ -194,26 +192,26 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing testUtils.Request{ TransactionID: immutable.Some(0), Request: `mutation { - create_Book(input: {name: "Book By Website", rating: 4.0, publisher_id: "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4"}) { + create_Book(input: {name: "Book By Website", rating: 4.0, publisher_id: "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed"}) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, testUtils.Request{ TransactionID: immutable.Some(1), Request: `mutation { - create_Book(input: {name: "Book By Online", rating: 4.0, publisher_id: "bae-8a381044-9206-51e7-8bc8-dc683d5f2523"}) { + create_Book(input: {name: "Book By Online", rating: 4.0, publisher_id: "bae-21084f46-b12a-53ab-94dd-04d075b4218c"}) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", }, }, }, @@ -232,10 +230,10 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", "name": "Book By Website", "publisher": map[string]any{ - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", }, }, @@ -256,10 +254,10 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing }`, Results: []map[string]any{ { - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", "name": "Book By Online", "publisher": map[string]any{ - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", "name": "Online", }, }, @@ -286,19 +284,19 @@ func TestTransactionalCreationAndLinkingOfRelationalDocumentsBackward(t *testing }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": map[string]any{ - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", "name": "Book By Website", }, }, { - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", "name": "Online", "published": map[string]any{ - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", "name": "Book By Online", }, }, diff --git a/tests/integration/mutation/create/simple_test.go b/tests/integration/mutation/create/simple_test.go index d095fdfc6d..61280c0cc8 100644 --- a/tests/integration/mutation/create/simple_test.go +++ b/tests/integration/mutation/create/simple_test.go @@ -89,7 +89,7 @@ func TestMutationCreate(t *testing.T) { `, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-8c89a573-c287-5d8c-8ba6-c47c814c594d", "name": "John", "age": int64(27), }, @@ -157,7 +157,7 @@ func TestMutationCreate_GivenEmptyInput(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-524bfa06-849c-5daf-b6df-05c2da80844d", + "_docID": "bae-332de69b-47da-5175-863f-2480107f4884", }, }, }, diff --git a/tests/integration/mutation/create/with_version_test.go b/tests/integration/mutation/create/with_version_test.go index 69f6d2b9f3..ea44ba6038 100644 --- a/tests/integration/mutation/create/with_version_test.go +++ b/tests/integration/mutation/create/with_version_test.go @@ -39,7 +39,7 @@ func TestMutationCreate_ReturnsVersionCID(t *testing.T) { { "_version": []map[string]any{ { - "cid": "bafyreifvrmwmlwtglxe3afki36spu6d5qs6vvza57kxs4giyi53r5vbbnu", + "cid": "bafyreicceacb554vtciciumodqmz6vmnfvr6uod2hfhnwujmfqx5pgq3fi", }, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go b/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go index 260a9a7b70..8b8e7088a6 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_many/with_show_deleted_test.go @@ -11,12 +11,8 @@ package one_to_many import ( - "fmt" "testing" - "github.com/stretchr/testify/require" - - "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration" ) @@ -34,32 +30,6 @@ type Author { ` func TestDeletionOfADocumentUsingSingleDocIDWithShowDeletedDocumentQuery(t *testing.T) { - colDefMap, err := testUtils.ParseSDL(schemas) - require.NoError(t, err) - - jsonString1 := `{ - "name": "John", - "age": 30 - }` - doc1, err := client.NewDocFromJSON([]byte(jsonString1), colDefMap["Author"]) - require.NoError(t, err) - - jsonString2 := fmt.Sprintf(`{ - "name": "John and the philosopher are stoned", - "rating": 9.9, - "author_id": "%s" - }`, doc1.ID()) - doc2, err := client.NewDocFromJSON([]byte(jsonString2), colDefMap["Book"]) - require.NoError(t, err) - - jsonString3 := fmt.Sprintf(`{ - "name": "John has a chamber of secrets", - "rating": 9.9, - "author_id": "%s" - }`, doc1.ID()) - // doc3, err := client.NewDocFromJSON([]byte(jsonString1)) - // require.NoError(t, err) - test := testUtils.TestCase{ Description: "One to many delete document using single document id, show deleted.", Actions: []any{ @@ -68,25 +38,36 @@ func TestDeletionOfADocumentUsingSingleDocIDWithShowDeletedDocumentQuery(t *test }, testUtils.CreateDoc{ CollectionID: 1, - Doc: jsonString1, + Doc: `{ + "name": "John", + "age": 30 + }`, }, testUtils.CreateDoc{ CollectionID: 0, - Doc: jsonString2, + DocMap: map[string]any{ + "name": "John and the philosopher are stoned", + "rating": 9.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 0, - Doc: jsonString3, + DocMap: map[string]any{ + "name": "John has a chamber of secrets", + "rating": 9.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ - Request: fmt.Sprintf(`mutation { - delete_Book(docID: "%s") { + Request: `mutation { + delete_Book(docID: "bae-b5c56d8f-b2f5-57f9-b371-4e9e04903e91") { _docID } - }`, doc2.ID()), + }`, Results: []map[string]any{ { - "_docID": doc2.ID().String(), + "_docID": "bae-b5c56d8f-b2f5-57f9-b371-4e9e04903e91", }, }, }, @@ -110,13 +91,13 @@ func TestDeletionOfADocumentUsingSingleDocIDWithShowDeletedDocumentQuery(t *test "age": int64(30), "published": []map[string]any{ { - "_deleted": true, - "name": "John and the philosopher are stoned", + "_deleted": false, + "name": "John has a chamber of secrets", "rating": 9.9, }, { - "_deleted": false, - "name": "John has a chamber of secrets", + "_deleted": true, + "name": "John and the philosopher are stoned", "rating": 9.9, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go index 2efa3ef960..057f20a00b 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_id_test.go @@ -24,28 +24,28 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { testUtils.CreateDoc{ // Books CollectionID: 0, - // bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2 + // bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40 Doc: `{ "name": "100 Go Mistakes to Avoid.", "rating": 4.8, - "publisher_id": "bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3" + "publisher_id": "bae-9c689bec-071e-5650-9378-bc11d5d3325c" }`, }, testUtils.CreateDoc{ // Authors CollectionID: 1, - // bae-2f80f359-535d-508e-ba58-088a309ce3c3 + // bae-455081f4-b810-5363-ab95-50dbd2ec03d0 Doc: `{ "name": "Teiva Harsanyi", "age": 48, "verified": true, - "wrote_id": "bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2" + "wrote_id": "bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40" }`, }, testUtils.CreateDoc{ // Publishers CollectionID: 2, - // bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3 + // bae-9c689bec-071e-5650-9378-bc11d5d3325c Doc: `{ "name": "Manning Early Access Program (MEAP)", "address": "Online" @@ -53,13 +53,13 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_Author(docID: "bae-2f80f359-535d-508e-ba58-088a309ce3c3") { + delete_Author(docID: "bae-455081f4-b810-5363-ab95-50dbd2ec03d0") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-2f80f359-535d-508e-ba58-088a309ce3c3", + "_docID": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", }, }, }, @@ -72,28 +72,28 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { testUtils.CreateDoc{ // Books CollectionID: 0, - // bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2 + // bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40 Doc: `{ "name": "100 Go Mistakes to Avoid.", "rating": 4.8, - "publisher_id": "bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3" + "publisher_id": "bae-9c689bec-071e-5650-9378-bc11d5d3325c" }`, }, testUtils.CreateDoc{ // Authors CollectionID: 1, - // bae-2f80f359-535d-508e-ba58-088a309ce3c3 + // bae-455081f4-b810-5363-ab95-50dbd2ec03d0 Doc: `{ "name": "Teiva Harsanyi", "age": 48, "verified": true, - "wrote_id": "bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2" + "wrote_id": "bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40" }`, }, testUtils.CreateDoc{ // Publishers CollectionID: 2, - // bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3 + // bae-9c689bec-071e-5650-9378-bc11d5d3325c Doc: `{ "name": "Manning Early Access Program (MEAP)", "address": "Online" @@ -101,13 +101,13 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_Author(docID: "bae-2f80f359-535d-508e-ba58-088a309ce3c3") { + delete_Author(docID: "bae-455081f4-b810-5363-ab95-50dbd2ec03d0") { AliasOfKey: _docID } }`, Results: []map[string]any{ { - "AliasOfKey": "bae-2f80f359-535d-508e-ba58-088a309ce3c3", + "AliasOfKey": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", }, }, }, @@ -120,28 +120,28 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { testUtils.CreateDoc{ // Books CollectionID: 0, - // bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2 + // bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40 Doc: `{ "name": "100 Go Mistakes to Avoid.", "rating": 4.8, - "publisher_id": "bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3" + "publisher_id": "bae-9c689bec-071e-5650-9378-bc11d5d3325c" }`, }, testUtils.CreateDoc{ // Authors CollectionID: 1, - // bae-2f80f359-535d-508e-ba58-088a309ce3c3 + // bae-455081f4-b810-5363-ab95-50dbd2ec03d0 Doc: `{ "name": "Teiva Harsanyi", "age": 48, "verified": true, - "wrote_id": "bae-80eded16-ee4b-5c9d-b33f-6a7b83958af2" + "wrote_id": "bae-8e8b2923-e167-5fd9-aee6-98267dd0ab40" }`, }, testUtils.CreateDoc{ // Publishers CollectionID: 2, - // bae-176ebdf0-77e7-5b2f-91ae-f620e37a29e3 + // bae-9c689bec-071e-5650-9378-bc11d5d3325c Doc: `{ "name": "Manning Early Access Program (MEAP)", "address": "Online" @@ -166,13 +166,13 @@ func TestRelationalDeletionOfADocumentUsingSingleKey_Success(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_Author(docID: "bae-2f80f359-535d-508e-ba58-088a309ce3c3") { + delete_Author(docID: "bae-455081f4-b810-5363-ab95-50dbd2ec03d0") { Key: _docID } }`, Results: []map[string]any{ { - "Key": "bae-2f80f359-535d-508e-ba58-088a309ce3c3", + "Key": "bae-455081f4-b810-5363-ab95-50dbd2ec03d0", }, }, }, diff --git a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go index 4eed71eeb4..9298f26198 100644 --- a/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go +++ b/tests/integration/mutation/delete/field_kinds/one_to_one_to_one/with_txn_test.go @@ -25,17 +25,17 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideForwardDirection(t *testing.T) { testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + // "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", Doc: `{ "name": "Book By Website", "rating": 4.0, - "publisher_id": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4" + "publisher_id": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -45,13 +45,13 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideForwardDirection(t *testing.T) { // Delete a linked book that exists. TransactionID: immutable.Some(0), Request: `mutation { - delete_Book(docID: "bae-37de3681-1856-5bc9-9fd6-1595647b7d96") { + delete_Book(docID: "bae-e7943028-5c74-5fd4-9661-0a233edcd287") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, @@ -72,7 +72,7 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideForwardDirection(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": nil, }, @@ -91,17 +91,17 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideBackwardDirection(t *testing.T) { testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + // "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", Doc: `{ "name": "Book By Website", "rating": 4.0, - "publisher_id": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4" + "publisher_id": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -111,13 +111,13 @@ func TestTxnDeletionOfRelatedDocFromPrimarySideBackwardDirection(t *testing.T) { // Delete a linked book that exists. TransactionID: immutable.Some(0), Request: `mutation { - delete_Book(docID: "bae-37de3681-1856-5bc9-9fd6-1595647b7d96") { + delete_Book(docID: "bae-e7943028-5c74-5fd4-9661-0a233edcd287") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, @@ -151,17 +151,17 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + // "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", Doc: `{ "name": "Book By Website", "rating": 4.0, - "publisher_id": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4" + "publisher_id": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -171,13 +171,13 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes // Delete a linked book that exists. TransactionID: immutable.Some(0), Request: `mutation { - delete_Book(docID: "bae-37de3681-1856-5bc9-9fd6-1595647b7d96") { + delete_Book(docID: "bae-e7943028-5c74-5fd4-9661-0a233edcd287") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, @@ -196,10 +196,10 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": map[string]any{ - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", "name": "Book By Website", }, }, @@ -222,7 +222,7 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnForwardDirection(t *tes }`, Results: []map[string]any{ { - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", "published": nil, }, @@ -241,17 +241,17 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + // "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", Doc: `{ "name": "Book By Website", "rating": 4.0, - "publisher_id": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4" + "publisher_id": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + // "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", Doc: `{ "name": "Website", "address": "Manning Publications" @@ -261,13 +261,13 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te // Delete a linked book that exists in transaction 0. TransactionID: immutable.Some(0), Request: `mutation { - delete_Book(docID: "bae-37de3681-1856-5bc9-9fd6-1595647b7d96") { + delete_Book(docID: "bae-e7943028-5c74-5fd4-9661-0a233edcd287") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", }, }, }, @@ -286,10 +286,10 @@ func TestATxnCanReadARecordThatIsDeletedInANonCommitedTxnBackwardDirection(t *te }`, Results: []map[string]any{ { - "_docID": "bae-37de3681-1856-5bc9-9fd6-1595647b7d96", + "_docID": "bae-e7943028-5c74-5fd4-9661-0a233edcd287", "name": "Book By Website", "publisher": map[string]any{ - "_docID": "bae-0e7c3bb5-4917-5d98-9fcf-b9db369ea6e4", + "_docID": "bae-07fd000a-d023-54b9-b8f3-a4318fac8fed", "name": "Website", }, }, @@ -325,17 +325,17 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideForwardDirection(t *testing.T) testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + // "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", Doc: `{ "name": "Book By Online", "rating": 4.0, - "publisher_id": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523" + "publisher_id": "bae-21084f46-b12a-53ab-94dd-04d075b4218c" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + // "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", Doc: `{ "name": "Online", "address": "Manning Early Access Program (MEAP)" @@ -346,13 +346,13 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideForwardDirection(t *testing.T) // book gets correctly unlinked too. TransactionID: immutable.Some(0), Request: `mutation { - delete_Publisher(docID: "bae-8a381044-9206-51e7-8bc8-dc683d5f2523") { + delete_Publisher(docID: "bae-21084f46-b12a-53ab-94dd-04d075b4218c") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", }, }, }, @@ -386,17 +386,17 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideBackwardDirection(t *testing.T testUtils.CreateDoc{ // books CollectionID: 0, - // "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + // "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", Doc: `{ "name": "Book By Online", "rating": 4.0, - "publisher_id": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523" + "publisher_id": "bae-21084f46-b12a-53ab-94dd-04d075b4218c" }`, }, testUtils.CreateDoc{ // publishers CollectionID: 2, - // "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + // "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", Doc: `{ "name": "Online", "address": "Manning Early Access Program (MEAP)" @@ -407,13 +407,13 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideBackwardDirection(t *testing.T // book gets correctly unlinked too. TransactionID: immutable.Some(0), Request: `mutation { - delete_Publisher(docID: "bae-8a381044-9206-51e7-8bc8-dc683d5f2523") { + delete_Publisher(docID: "bae-21084f46-b12a-53ab-94dd-04d075b4218c") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-8a381044-9206-51e7-8bc8-dc683d5f2523", + "_docID": "bae-21084f46-b12a-53ab-94dd-04d075b4218c", }, }, }, @@ -434,7 +434,7 @@ func TestTxnDeletionOfRelatedDocFromNonPrimarySideBackwardDirection(t *testing.T }`, Results: []map[string]any{ { - "_docID": "bae-60ffc9b4-0e31-5d63-82dc-c5cb007f2985", + "_docID": "bae-7f6a5a76-b90d-5715-a452-708ded9e7ae7", "name": "Book By Online", "publisher": nil, }, diff --git a/tests/integration/mutation/delete/with_deleted_field_test.go b/tests/integration/mutation/delete/with_deleted_field_test.go index 0067b8b12c..274d224253 100644 --- a/tests/integration/mutation/delete/with_deleted_field_test.go +++ b/tests/integration/mutation/delete/with_deleted_field_test.go @@ -34,7 +34,7 @@ func TestMutationDeletion_WithDeletedField(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad") { + delete_User(docID: "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f") { _deleted _docID } @@ -42,7 +42,7 @@ func TestMutationDeletion_WithDeletedField(t *testing.T) { Results: []map[string]any{ { "_deleted": true, - "_docID": "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", + "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", }, }, }, diff --git a/tests/integration/mutation/delete/with_filter_test.go b/tests/integration/mutation/delete/with_filter_test.go index 79bf04753d..1884d38e17 100644 --- a/tests/integration/mutation/delete/with_filter_test.go +++ b/tests/integration/mutation/delete/with_filter_test.go @@ -135,13 +135,13 @@ func TestMutationDeletion_WithEmptyFilter(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Fred", + "name": "John", }, { "name": "Shahzad", }, { - "name": "John", + "name": "Fred", }, }, }, diff --git a/tests/integration/mutation/delete/with_id_alias_test.go b/tests/integration/mutation/delete/with_id_alias_test.go index 5709b7cadc..c9d259ac8b 100644 --- a/tests/integration/mutation/delete/with_id_alias_test.go +++ b/tests/integration/mutation/delete/with_id_alias_test.go @@ -34,13 +34,13 @@ func TestMutationDeletion_WithIDAndAlias(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c"]) { fancyKey: _docID } }`, Results: []map[string]any{ { - "fancyKey": "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", + "fancyKey": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", }, }, }, diff --git a/tests/integration/mutation/delete/with_id_test.go b/tests/integration/mutation/delete/with_id_test.go index 78c923693e..774e9a8c18 100644 --- a/tests/integration/mutation/delete/with_id_test.go +++ b/tests/integration/mutation/delete/with_id_test.go @@ -29,7 +29,7 @@ func TestMutationDeletion_WithIDUnknownValue(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c"]) { _docID } }`, @@ -59,7 +59,7 @@ func TestMutationDeletion_WithIDUnknownValueAndUnrelatedRecordInCollection(t *te }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c"]) { _docID } }`, diff --git a/tests/integration/mutation/delete/with_id_txn_test.go b/tests/integration/mutation/delete/with_id_txn_test.go index aeb6a4772b..f704acea56 100644 --- a/tests/integration/mutation/delete/with_id_txn_test.go +++ b/tests/integration/mutation/delete/with_id_txn_test.go @@ -37,13 +37,13 @@ func TestMutationDeletion_WithIDAndTxn(t *testing.T) { testUtils.Request{ TransactionID: immutable.Some(0), Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c"]) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_alias_test.go b/tests/integration/mutation/delete/with_ids_alias_test.go index e91432e787..b815ec703d 100644 --- a/tests/integration/mutation/delete/with_ids_alias_test.go +++ b/tests/integration/mutation/delete/with_ids_alias_test.go @@ -48,16 +48,16 @@ func TestMutationDeletion_WithIDsAndSelectAlias(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-6a6482a8-24e1-5c73-a237-ca569e41507d", "bae-3a1a496e-24eb-5ae3-9c17-524c146a393e"]) { + delete_User(docIDs: ["bae-959725a4-17cb-5e04-8908-98bc78fd06dd", "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0"]) { AliasID: _docID } }`, Results: []map[string]any{ { - "AliasID": "bae-3a1a496e-24eb-5ae3-9c17-524c146a393e", + "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", }, { - "AliasID": "bae-6a6482a8-24e1-5c73-a237-ca569e41507d", + "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_filter_test.go b/tests/integration/mutation/delete/with_ids_filter_test.go index 02ddb656f7..41f79fa859 100644 --- a/tests/integration/mutation/delete/with_ids_filter_test.go +++ b/tests/integration/mutation/delete/with_ids_filter_test.go @@ -34,13 +34,13 @@ func TestMutationDeletion_WithIDsAndEmptyFilter(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5"], filter: {}) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c"], filter: {}) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_test.go b/tests/integration/mutation/delete/with_ids_test.go index 18371c2d70..4f3e462b00 100644 --- a/tests/integration/mutation/delete/with_ids_test.go +++ b/tests/integration/mutation/delete/with_ids_test.go @@ -39,16 +39,16 @@ func TestMutationDeletion_WithIDs(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c", "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f"]) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", + "_docID": "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f", }, { - "_docID": "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", }, }, }, @@ -96,10 +96,10 @@ func TestMutationDeletion_WithEmptyIDs(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Shahzad", + "name": "John", }, { - "name": "John", + "name": "Shahzad", }, }, }, @@ -177,13 +177,13 @@ func TestMutationDeletion_WithIDsKnownAndUnknown(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad"]) { + delete_User(docIDs: ["bae-22dacd35-4560-583a-9a80-8edbf28aa85c", "bae-1ef746f8-821e-586f-99b2-4cb1fb9b782f"]) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5", + "_docID": "bae-22dacd35-4560-583a-9a80-8edbf28aa85c", }, }, }, diff --git a/tests/integration/mutation/delete/with_ids_txn_test.go b/tests/integration/mutation/delete/with_ids_txn_test.go index c59ec5c262..53cb44c9e9 100644 --- a/tests/integration/mutation/delete/with_ids_txn_test.go +++ b/tests/integration/mutation/delete/with_ids_txn_test.go @@ -43,20 +43,20 @@ func TestMutationDeletion_WithIDsAndTxn(t *testing.T) { testUtils.Request{ TransactionID: immutable.Some(0), Request: `mutation { - delete_User(docIDs: ["bae-6a6482a8-24e1-5c73-a237-ca569e41507d"]) { + delete_User(docIDs: ["bae-959725a4-17cb-5e04-8908-98bc78fd06dd"]) { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-6a6482a8-24e1-5c73-a237-ca569e41507d", + "_docID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", }, }, }, testUtils.Request{ TransactionID: immutable.Some(0), Request: `query { - User(docIDs: ["bae-6a6482a8-24e1-5c73-a237-ca569e41507d"]) { + User(docIDs: ["bae-959725a4-17cb-5e04-8908-98bc78fd06dd"]) { _docID } }`, diff --git a/tests/integration/mutation/delete/with_ids_update_alias_test.go b/tests/integration/mutation/delete/with_ids_update_alias_test.go index 076f4f9967..551b52a175 100644 --- a/tests/integration/mutation/delete/with_ids_update_alias_test.go +++ b/tests/integration/mutation/delete/with_ids_update_alias_test.go @@ -56,16 +56,16 @@ func TestMutationDeletion_WithUpdateAndIDsAndSelectAlias(t *testing.T) { }, testUtils.Request{ Request: `mutation { - delete_User(docIDs: ["bae-6a6482a8-24e1-5c73-a237-ca569e41507d", "bae-3a1a496e-24eb-5ae3-9c17-524c146a393e"]) { + delete_User(docIDs: ["bae-959725a4-17cb-5e04-8908-98bc78fd06dd", "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0"]) { AliasID: _docID } }`, Results: []map[string]any{ { - "AliasID": "bae-3a1a496e-24eb-5ae3-9c17-524c146a393e", + "AliasID": "bae-3eed37ed-5c7b-53ff-b125-d04fb173f6c0", }, { - "AliasID": "bae-6a6482a8-24e1-5c73-a237-ca569e41507d", + "AliasID": "bae-959725a4-17cb-5e04-8908-98bc78fd06dd", }, }, }, diff --git a/tests/integration/mutation/mix/with_txn_test.go b/tests/integration/mutation/mix/with_txn_test.go index de45e22fd4..b7c193b10b 100644 --- a/tests/integration/mutation/mix/with_txn_test.go +++ b/tests/integration/mutation/mix/with_txn_test.go @@ -39,20 +39,20 @@ func TestMutationWithTxnDeletesUserGivenSameTransaction(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", }, }, }, testUtils.Request{ TransactionID: immutable.Some(0), Request: `mutation { - delete_User(docID: "bae-88b63198-7d38-5714-a9ff-21ba46374fd1") { + delete_User(docID: "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9") { _docID } }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", }, }, }, @@ -83,14 +83,14 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", }, }, }, testUtils.Request{ TransactionID: immutable.Some(1), Request: `mutation { - delete_User(docID: "bae-88b63198-7d38-5714-a9ff-21ba46374fd1") { + delete_User(docID: "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9") { _docID } }`, @@ -107,7 +107,7 @@ func TestMutationWithTxnDoesNotDeletesUserGivenDifferentTransactions(t *testing. }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(27), }, @@ -157,7 +157,7 @@ func TestMutationWithTxnDoesUpdateUserGivenSameTransactions(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", }, }, }, @@ -172,7 +172,7 @@ func TestMutationWithTxnDoesUpdateUserGivenSameTransactions(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(28), }, @@ -213,7 +213,7 @@ func TestMutationWithTxnDoesNotUpdateUserGivenDifferentTransactions(t *testing.T }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(28), }, @@ -230,7 +230,7 @@ func TestMutationWithTxnDoesNotUpdateUserGivenDifferentTransactions(t *testing.T }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(27), }, @@ -272,7 +272,7 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(28), }, @@ -289,7 +289,7 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(29), }, @@ -313,7 +313,7 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }`, Results: []map[string]any{ { - "_docID": "bae-88b63198-7d38-5714-a9ff-21ba46374fd1", + "_docID": "bae-948fc3eb-9b68-5a8d-9c3c-8f76157002a9", "name": "John", "age": int64(28), }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go b/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go index dda55ffcfa..1b515c62fd 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_many/simple_test.go @@ -20,7 +20,7 @@ import ( ) func TestMutationUpdateOneToMany_RelationIDToLinkFromSingleSide_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" test := testUtils.TestCase{ @@ -75,7 +75,7 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromSingleSide_Error(t *testing // Note: This test should probably not pass, as it contains a // reference to a document that doesnt exist. func TestMutationUpdateOneToMany_InvalidRelationIDToLinkFromManySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" invalidAuthorID := "bae-35953ca-518d-9e6b-9ce6cd00eff5" test := testUtils.TestCase{ @@ -146,8 +146,8 @@ func TestMutationUpdateOneToMany_InvalidRelationIDToLinkFromManySide(t *testing. } func TestMutationUpdateOneToMany_RelationIDToLinkFromManySideWithWrongField_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" + author2ID := "bae-789d10d4-e54f-531b-ae81-e15100f8e506" test := testUtils.TestCase{ Description: "One to many update mutation using relation id from many side, with a wrong field.", @@ -199,8 +199,8 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromManySideWithWrongField_Erro } func TestMutationUpdateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" + author2ID := "bae-789d10d4-e54f-531b-ae81-e15100f8e506" test := testUtils.TestCase{ Description: "One to many update mutation using relation id from many side", @@ -247,10 +247,6 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { } }`, Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{}, - }, { "name": "New Shahzad", "published": []map[string]any{ @@ -259,6 +255,10 @@ func TestMutationUpdateOneToMany_RelationIDToLinkFromManySide(t *testing.T) { }, }, }, + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, testUtils.Request{ diff --git a/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go b/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go index d3df327de2..bc0af76015 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_many/with_alias_test.go @@ -20,7 +20,7 @@ import ( ) func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromSingleSide_Collection(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" test := testUtils.TestCase{ @@ -74,7 +74,7 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromSingleSide_Collectio } func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromSingleSide_GQL(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" test := testUtils.TestCase{ @@ -129,7 +129,7 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromSingleSide_GQL(t *te // Note: This test should probably not pass, as it contains a // reference to a document that doesnt exist. func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_GQL(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" invalidAuthorID := "bae-35953ca-518d-9e6b-9ce6cd00eff5" test := testUtils.TestCase{ @@ -202,7 +202,7 @@ func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_GQL( // Note: This test should probably not pass, as it contains a // reference to a document that doesnt exist. func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_Collection(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" invalidAuthorID := "bae-35953ca-518d-9e6b-9ce6cd00eff5" test := testUtils.TestCase{ @@ -257,8 +257,8 @@ func TestMutationUpdateOneToMany_InvalidAliasRelationNameToLinkFromManySide_Coll } func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySideWithWrongField_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" + author2ID := "bae-789d10d4-e54f-531b-ae81-e15100f8e506" test := testUtils.TestCase{ Description: "One to many update mutation using relation alias name from many side, with a wrong field.", @@ -310,8 +310,8 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySideWithWrongFie } func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-a47f80ab-1c30-53b3-9dac-04a4a3fda77e" + author2ID := "bae-789d10d4-e54f-531b-ae81-e15100f8e506" test := testUtils.TestCase{ Description: "One to many update mutation using relation alias name from many side", @@ -358,10 +358,6 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySide(t *testing. } }`, Results: []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{}, - }, { "name": "New Shahzad", "published": []map[string]any{ @@ -370,6 +366,10 @@ func TestMutationUpdateOneToMany_AliasRelationNameToLinkFromManySide(t *testing. }, }, }, + { + "name": "John Grisham", + "published": []map[string]any{}, + }, }, }, testUtils.Request{ diff --git a/tests/integration/mutation/update/field_kinds/one_to_one/with_alias_test.go b/tests/integration/mutation/update/field_kinds/one_to_one/with_alias_test.go index 39e132a6c6..5996dde5ea 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_one/with_alias_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_one/with_alias_test.go @@ -20,8 +20,8 @@ import ( ) func TestMutationUpdateOneToOne_AliasRelationNameToLinkFromPrimarySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + bookID := "bae-dfce6a1a-27fa-5dde-bea7-44df2dffac1a" test := testUtils.TestCase{ Description: "One to one update mutation using alias relation id from single side", @@ -66,8 +66,8 @@ func TestMutationUpdateOneToOne_AliasRelationNameToLinkFromPrimarySide(t *testin } func TestMutationUpdateOneToOne_AliasRelationNameToLinkFromSecondarySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + author2ID := "bae-a34d8759-e549-5083-8ba6-e04038c41caa" test := testUtils.TestCase{ Description: "One to one update mutation using alias relation id from secondary side", @@ -112,7 +112,7 @@ func TestMutationUpdateOneToOne_AliasRelationNameToLinkFromSecondarySide(t *test } func TestMutationUpdateOneToOne_AliasWithInvalidLengthRelationIDToLink_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" invalidLenSubID := "35953ca-518d-9e6b-9ce6cd00eff5" invalidAuthorID := "bae-" + invalidLenSubID @@ -153,7 +153,7 @@ func TestMutationUpdateOneToOne_AliasWithInvalidLengthRelationIDToLink_Error(t * } func TestMutationUpdateOneToOne_InvalidAliasRelationNameToLinkFromSecondarySide_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" invalidAuthorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ee" test := testUtils.TestCase{ @@ -193,8 +193,8 @@ func TestMutationUpdateOneToOne_InvalidAliasRelationNameToLinkFromSecondarySide_ } func TestMutationUpdateOneToOne_AliasRelationNameToLinkFromSecondarySideWithWrongField_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + author2ID := "bae-a34d8759-e549-5083-8ba6-e04038c41caa" test := testUtils.TestCase{ Description: "One to one update mutation using relation alias name from secondary side, with a wrong field.", diff --git a/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go b/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go index 16225f4ab3..dc49999627 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_one/with_self_ref_test.go @@ -18,7 +18,7 @@ import ( ) func TestMutationUpdateOneToOne_SelfReferencingFromPrimary(t *testing.T) { - user1ID := "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + user1ID := "bae-ec56fb02-88fb-5113-b4d8-1b9be5f2217b" test := testUtils.TestCase{ Description: "One to one update mutation, self referencing from primary", @@ -104,7 +104,7 @@ func TestMutationUpdateOneToOne_SelfReferencingFromPrimary(t *testing.T) { } func TestMutationUpdateOneToOne_SelfReferencingFromSecondary(t *testing.T) { - user1ID := "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + user1ID := "bae-12a7f594-f02e-53b7-81c4-aba27b2e7ea7" test := testUtils.TestCase{ Description: "One to one update mutation, self referencing from secondary", @@ -149,16 +149,16 @@ func TestMutationUpdateOneToOne_SelfReferencingFromSecondary(t *testing.T) { } }`, Results: []map[string]any{ + { + "name": "John", + "boss": nil, + }, { "name": "Fred", "boss": map[string]any{ "name": "John", }, }, - { - "name": "John", - "boss": nil, - }, }, }, testUtils.Request{ @@ -172,16 +172,16 @@ func TestMutationUpdateOneToOne_SelfReferencingFromSecondary(t *testing.T) { } }`, Results: []map[string]any{ - { - "name": "Fred", - "underling": nil, - }, { "name": "John", "underling": map[string]any{ "name": "Fred", }, }, + { + "name": "Fred", + "underling": nil, + }, }, }, }, diff --git a/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go b/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go index 0c05734204..c2df5a9db8 100644 --- a/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go +++ b/tests/integration/mutation/update/field_kinds/one_to_one/with_simple_test.go @@ -22,7 +22,7 @@ import ( // Note: This test should probably not pass, as it contains a // reference to a document that doesnt exist. func TestMutationUpdateOneToOneNoChild(t *testing.T) { - unknownID := "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + unknownID := "bae-be6d8024-4953-5a92-84b4-f042d25230c6" test := testUtils.TestCase{ Description: "One to one create mutation, from the wrong side", @@ -61,7 +61,7 @@ func TestMutationUpdateOneToOneNoChild(t *testing.T) { } func TestMutationUpdateOneToOne(t *testing.T) { - bookID := "bae-3d236f89-6a31-5add-a36a-27971a2eac76" + bookID := "bae-dafb74e9-2bf1-5f12-aea9-967814592bad" test := testUtils.TestCase{ Description: "One to one update mutation", @@ -133,7 +133,7 @@ func TestMutationUpdateOneToOne(t *testing.T) { } func TestMutationUpdateOneToOneSecondarySide(t *testing.T) { - authorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + authorID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" test := testUtils.TestCase{ Description: "One to one create mutation, from the secondary side", @@ -204,8 +204,8 @@ func TestMutationUpdateOneToOneSecondarySide(t *testing.T) { } func TestMutationUpdateOneToOne_RelationIDToLinkFromPrimarySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - bookID := "bae-22e0a1c2-d12b-5bfd-b039-0cf72f963991" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + bookID := "bae-dfce6a1a-27fa-5dde-bea7-44df2dffac1a" test := testUtils.TestCase{ Description: "One to one update mutation using relation id from single side (wrong)", @@ -250,8 +250,8 @@ func TestMutationUpdateOneToOne_RelationIDToLinkFromPrimarySide(t *testing.T) { } func TestMutationUpdateOneToOne_RelationIDToLinkFromSecondarySide(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + author2ID := "bae-a34d8759-e549-5083-8ba6-e04038c41caa" test := testUtils.TestCase{ Description: "One to one update mutation using relation id from secondary side", @@ -296,7 +296,7 @@ func TestMutationUpdateOneToOne_RelationIDToLinkFromSecondarySide(t *testing.T) } func TestMutationUpdateOneToOne_InvalidLengthRelationIDToLink_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" invalidLenSubID := "35953ca-518d-9e6b-9ce6cd00eff5" invalidAuthorID := "bae-" + invalidLenSubID @@ -337,7 +337,7 @@ func TestMutationUpdateOneToOne_InvalidLengthRelationIDToLink_Error(t *testing.T } func TestMutationUpdateOneToOne_InvalidRelationIDToLinkFromSecondarySide_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" invalidAuthorID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ee" test := testUtils.TestCase{ @@ -377,8 +377,8 @@ func TestMutationUpdateOneToOne_InvalidRelationIDToLinkFromSecondarySide_Error(t } func TestMutationUpdateOneToOne_RelationIDToLinkFromSecondarySideWithWrongField_Error(t *testing.T) { - author1ID := "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - author2ID := "bae-35953caf-4898-518d-9e6b-9ce6cd86ebe5" + author1ID := "bae-42d197b8-d14f-5570-a55d-9e8714b2a82a" + author2ID := "bae-a34d8759-e549-5083-8ba6-e04038c41caa" test := testUtils.TestCase{ Description: "One to one update mutation using relation id from secondary side, with a wrong field.", diff --git a/tests/integration/mutation/update/with_id_test.go b/tests/integration/mutation/update/with_id_test.go index 899711a1ab..342e228052 100644 --- a/tests/integration/mutation/update/with_id_test.go +++ b/tests/integration/mutation/update/with_id_test.go @@ -29,7 +29,7 @@ func TestMutationUpdate_WithId(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-cc36febf-4029-52b3-a876-c99c6293f588 + // bae-0289c22a-aec7-5b59-adfc-60968698fcdf Doc: `{ "name": "John", "points": 42.1 @@ -43,7 +43,7 @@ func TestMutationUpdate_WithId(t *testing.T) { }, testUtils.Request{ Request: `mutation { - update_Users(docID: "bae-cc36febf-4029-52b3-a876-c99c6293f588", input: {points: 59}) { + update_Users(docID: "bae-0289c22a-aec7-5b59-adfc-60968698fcdf", input: {points: 59}) { name points } @@ -74,7 +74,7 @@ func TestMutationUpdate_WithNonExistantId(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-cc36febf-4029-52b3-a876-c99c6293f588 + // bae-0289c22a-aec7-5b59-adfc-60968698fcdf Doc: `{ "name": "John", "points": 42.1 diff --git a/tests/integration/mutation/update/with_ids_test.go b/tests/integration/mutation/update/with_ids_test.go index 59f4e7ac73..5b7108948f 100644 --- a/tests/integration/mutation/update/with_ids_test.go +++ b/tests/integration/mutation/update/with_ids_test.go @@ -29,7 +29,7 @@ func TestMutationUpdate_WithIds(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-cc36febf-4029-52b3-a876-c99c6293f588 + // bae-0289c22a-aec7-5b59-adfc-60968698fcdf Doc: `{ "name": "John", "points": 42.1 @@ -42,7 +42,7 @@ func TestMutationUpdate_WithIds(t *testing.T) { }`, }, testUtils.CreateDoc{ - // bae-3ac659d1-521a-5eba-a833-5c58b151ca72 + // bae-fcc8673d-25f9-5f24-a529-4bc997035278 Doc: `{ "name": "Fred", "points": 33 @@ -51,7 +51,7 @@ func TestMutationUpdate_WithIds(t *testing.T) { testUtils.Request{ Request: `mutation { update_Users( - docIDs: ["bae-cc36febf-4029-52b3-a876-c99c6293f588", "bae-3ac659d1-521a-5eba-a833-5c58b151ca72"], + docIDs: ["bae-0289c22a-aec7-5b59-adfc-60968698fcdf", "bae-fcc8673d-25f9-5f24-a529-4bc997035278"], input: {points: 59} ) { name @@ -60,11 +60,11 @@ func TestMutationUpdate_WithIds(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Fred", + "name": "John", "points": float64(59), }, { - "name": "John", + "name": "Fred", "points": float64(59), }, }, diff --git a/tests/integration/net/one_to_many/peer/with_create_update_test.go b/tests/integration/net/one_to_many/peer/with_create_update_test.go index a7451fc956..e6862754de 100644 --- a/tests/integration/net/one_to_many/peer/with_create_update_test.go +++ b/tests/integration/net/one_to_many/peer/with_create_update_test.go @@ -63,7 +63,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin CollectionID: 1, DocID: 0, Doc: `{ - "Author_id": "bae-cf278a29-5680-565d-9c7f-4c46d3700cf0" + "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499" }`, }, testUtils.WaitForSync{}, @@ -81,7 +81,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin Results: []map[string]any{ { "Name": "Gulistan", - "Author_id": "bae-cf278a29-5680-565d-9c7f-4c46d3700cf0", + "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499", "Author": map[string]any{ "Name": "Saadi", }, @@ -102,7 +102,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin Results: []map[string]any{ { "Name": "Gulistan", - "Author_id": "bae-cf278a29-5680-565d-9c7f-4c46d3700cf0", + "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499", // "Saadi" was not synced to node 1, the update did not // result in an error and synced to relational id even though "Saadi" // does not exist in this node. diff --git a/tests/integration/net/one_to_many/replicator/with_create_test.go b/tests/integration/net/one_to_many/replicator/with_create_test.go index 10e80a9a02..7d2d706805 100644 --- a/tests/integration/net/one_to_many/replicator/with_create_test.go +++ b/tests/integration/net/one_to_many/replicator/with_create_test.go @@ -54,7 +54,7 @@ func TestP2POneToManyReplicator(t *testing.T) { CollectionID: 1, Doc: `{ "Name": "Gulistan", - "Author_id": "bae-cf278a29-5680-565d-9c7f-4c46d3700cf0" + "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499" }`, }, testUtils.WaitForSync{}, diff --git a/tests/integration/net/simple/peer/with_create_test.go b/tests/integration/net/simple/peer/with_create_test.go index a6c095024c..e89030690d 100644 --- a/tests/integration/net/simple/peer/with_create_test.go +++ b/tests/integration/net/simple/peer/with_create_test.go @@ -59,10 +59,10 @@ func TestP2PCreateDoesNotSync(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(300), }, { - "Age": int64(300), + "Age": int64(21), }, }, }, @@ -147,13 +147,13 @@ func TestP2PCreateWithP2PCollection(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(28), }, { "Age": int64(30), }, { - "Age": int64(28), + "Age": int64(21), }, // Peer sync should not sync new documents to nodes that is not subscribed // to the P2P collection. @@ -168,16 +168,16 @@ func TestP2PCreateWithP2PCollection(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(28), }, { - "Age": int64(31), + "Age": int64(30), }, { - "Age": int64(30), + "Age": int64(21), }, { - "Age": int64(28), + "Age": int64(31), }, }, }, diff --git a/tests/integration/net/simple/peer/with_delete_test.go b/tests/integration/net/simple/peer/with_delete_test.go index 49a0b98c41..b0b5fe3ded 100644 --- a/tests/integration/net/simple/peer/with_delete_test.go +++ b/tests/integration/net/simple/peer/with_delete_test.go @@ -123,16 +123,16 @@ func TestP2PWithMultipleDocumentsSingleDeleteWithShowDeleted(t *testing.T) { } }`, Results: []map[string]any{ - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), - }, { "_deleted": true, "Name": "John", "Age": int64(43), }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -195,16 +195,16 @@ func TestP2PWithMultipleDocumentsWithSingleUpdateBeforeConnectSingleDeleteWithSh } }`, Results: []map[string]any{ - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), - }, { "_deleted": true, "Name": "John", "Age": int64(60), }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -276,16 +276,16 @@ func TestP2PWithMultipleDocumentsWithMultipleUpdatesBeforeConnectSingleDeleteWit } }`, Results: []map[string]any{ - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), - }, { "_deleted": true, "Name": "John", "Age": int64(62), }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, }, @@ -367,16 +367,16 @@ func TestP2PWithMultipleDocumentsWithUpdateAndDeleteBeforeConnectSingleDeleteWit } }`, Results: []map[string]any{ - { - "_deleted": false, - "Name": "Andy", - "Age": int64(74), - }, { "_deleted": true, "Name": "John", "Age": int64(62), }, + { + "_deleted": false, + "Name": "Andy", + "Age": int64(74), + }, }, }, // The target node currently won't receive the pre-connection updates from the source. @@ -393,13 +393,13 @@ func TestP2PWithMultipleDocumentsWithUpdateAndDeleteBeforeConnectSingleDeleteWit Results: []map[string]any{ { "_deleted": false, - "Name": "Andy", - "Age": int64(74), + "Name": "John", + "Age": int64(66), }, { "_deleted": false, - "Name": "John", - "Age": int64(66), + "Name": "Andy", + "Age": int64(74), }, }, }, diff --git a/tests/integration/net/simple/peer_replicator/with_create_test.go b/tests/integration/net/simple/peer_replicator/with_create_test.go index c7b1bf0e8e..3b1f299cfa 100644 --- a/tests/integration/net/simple/peer_replicator/with_create_test.go +++ b/tests/integration/net/simple/peer_replicator/with_create_test.go @@ -63,10 +63,10 @@ func TestP2PPeerReplicatorWithCreate(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(3000), }, { - "Age": int64(3000), + "Age": int64(21), }, }, }, @@ -92,10 +92,10 @@ func TestP2PPeerReplicatorWithCreate(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(3000), }, { - "Age": int64(3000), + "Age": int64(21), }, }, }, diff --git a/tests/integration/net/simple/replicator/with_create_test.go b/tests/integration/net/simple/replicator/with_create_test.go index 0d3dbad143..5785337b98 100644 --- a/tests/integration/net/simple/replicator/with_create_test.go +++ b/tests/integration/net/simple/replicator/with_create_test.go @@ -361,10 +361,10 @@ func TestP2POneToOneReplicatorManyDocs(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(22), }, { - "Age": int64(22), + "Age": int64(21), }, }, }, @@ -421,10 +421,10 @@ func TestP2POneToManyReplicatorManyDocs(t *testing.T) { }`, Results: []map[string]any{ { - "Age": int64(21), + "Age": int64(22), }, { - "Age": int64(22), + "Age": int64(21), }, }, }, @@ -487,7 +487,7 @@ func TestP2POneToOneReplicatorOrderIndependent(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", "age": int64(21), "name": "John", "_version": []map[string]any{ @@ -549,7 +549,7 @@ func TestP2POneToOneReplicatorOrderIndependentDirectCreate(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "_docID": "bae-0b2f15e5-bfe7-5cb7-8045-471318d7dbc3", "_version": []map[string]any{ { "schemaVersionId": "bafkreihhd6bqrjhl5zidwztgxzeseveplv3cj3fwtn3unjkdx7j2vr2vrq", diff --git a/tests/integration/query/commits/simple_test.go b/tests/integration/query/commits/simple_test.go index 4b2d037d61..bcd7ccc1c0 100644 --- a/tests/integration/query/commits/simple_test.go +++ b/tests/integration/query/commits/simple_test.go @@ -36,13 +36,13 @@ func TestQueryCommits(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -79,22 +79,22 @@ func TestQueryCommitsMultipleDocs(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreidoznu3dbvgngnfk3xjjgpmrpjs3wrpbc7ntl3rbacspeee5kp53a", + "cid": "bafyreiazgtllwk7znzuapv3fsukzhpekqqjjvgv4fzypkfp7mljfabie3q", }, { - "cid": "bafyreia5q5oya6vnv2kvffzfnl23762zvtqxmatjd5s3ldpwxfdo3aey6i", + "cid": "bafyreicbr2jo7y4d6773q66kxvzq4k3jss2rw5ysr3co2mjdhcdyiz7buq", }, { - "cid": "bafyreibr7mv7b4kg4zym7fow6ljhl6kdzfgcvfi5q26ogz5gsev75ewxcq", + "cid": "bafyreihmvuytwy5ofcm5bqyazxwnquksutxvybznavmw23vddb7nooh6pq", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -125,15 +125,15 @@ func TestQueryCommitsWithSchemaVersionIDField(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", }, }, @@ -349,74 +349,74 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { `, Results: []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "collectionID": int64(1), "delta": testUtils.CBORValue(22), - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", "fieldId": "1", "fieldName": "age", "height": int64(2), "links": []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "_head", }, }, }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "collectionID": int64(1), "delta": testUtils.CBORValue(21), - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", "fieldId": "1", "fieldName": "age", "height": int64(1), "links": []map[string]any{}, }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "collectionID": int64(1), "delta": testUtils.CBORValue("John"), - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", "fieldId": "2", "fieldName": "name", "height": int64(1), "links": []map[string]any{}, }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "collectionID": int64(1), "delta": nil, - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", "fieldId": "C", "fieldName": nil, "height": int64(2), "links": []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "name": "_head", }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "name": "age", }, }, }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "collectionID": int64(1), "delta": nil, - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", "fieldId": "C", "fieldName": nil, "height": int64(1), "links": []map[string]any{ { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "name": "name", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "age", }, }, diff --git a/tests/integration/query/commits/with_cid_test.go b/tests/integration/query/commits/with_cid_test.go index 0c502ea7e2..6a85691e74 100644 --- a/tests/integration/query/commits/with_cid_test.go +++ b/tests/integration/query/commits/with_cid_test.go @@ -38,14 +38,14 @@ func TestQueryCommitsWithCid(t *testing.T) { testUtils.Request{ Request: `query { commits( - cid: "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq" + cid: "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq" ) { cid } }`, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -71,14 +71,14 @@ func TestQueryCommitsWithCidForFieldCommit(t *testing.T) { testUtils.Request{ Request: `query { commits( - cid: "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq" + cid: "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq" ) { cid } }`, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, diff --git a/tests/integration/query/commits/with_collectionid_prop_test.go b/tests/integration/query/commits/with_collectionid_prop_test.go index 6de4a71e2e..91d4d60373 100644 --- a/tests/integration/query/commits/with_collectionid_prop_test.go +++ b/tests/integration/query/commits/with_collectionid_prop_test.go @@ -43,19 +43,19 @@ func TestQueryCommitsWithCollectionID(t *testing.T) { }`, Results: []map[string]any{ { - "collectionID": int64(2), + "collectionID": int64(1), }, { - "collectionID": int64(2), + "collectionID": int64(1), }, { "collectionID": int64(1), }, { - "collectionID": int64(1), + "collectionID": int64(2), }, { - "collectionID": int64(1), + "collectionID": int64(2), }, }, }, diff --git a/tests/integration/query/commits/with_depth_test.go b/tests/integration/query/commits/with_depth_test.go index a950e72b85..7660a04585 100644 --- a/tests/integration/query/commits/with_depth_test.go +++ b/tests/integration/query/commits/with_depth_test.go @@ -36,13 +36,13 @@ func TestQueryCommitsWithDepth1(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -81,16 +81,16 @@ func TestQueryCommitsWithDepth1WithUpdate(t *testing.T) { Results: []map[string]any{ { // "Age" field head - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { // "Name" field head (unchanged from create) - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, }, @@ -137,27 +137,27 @@ func TestQueryCommitsWithDepth2WithUpdate(t *testing.T) { Results: []map[string]any{ { // Composite head - "cid": "bafyreial53rqep7uoheucc3rzvhs6dbhydnkbqe4w2bhd3hsybub4u3h6m", + "cid": "bafyreicoci4ah2uft5giiyl2lfg4jgcegwbvt3mbllnqnmfh3oy24usxsy", "height": int64(3), }, { // Composite head -1 - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { // "Name" field head (unchanged from create) - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { // "Age" field head - "cid": "bafyreifyknutg2lsajcsqrfegr65t5h5s743jkp3bfuzphx4nmqztfwmga", + "cid": "bafyreichbcwfiwampbb2w2stlrk5yryu5ao4ubz2utybv5fc6qioj3qhu4", "height": int64(3), }, { // "Age" field head -1 - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, }, @@ -195,22 +195,22 @@ func TestQueryCommitsWithDepth1AndMultipleDocs(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreicab3zaizu5bwyfn25hy5zf6hsdx6un5kyixiktxkgwtyobdlr52e", + "cid": "bafyreibqku2yhbclue774qtkh2gmn3oeaw7gan7ervjyqwqsxfr2c7ymwu", }, { - "cid": "bafyreig3kdxtlbaohkcxx5bysmyrjvdggoeq47x6cyrbyfevi2hbgkq4sa", + "cid": "bafyreicrku377qakqjzzlh4phornkj36otic6oc27ano6mril5hu5fuulu", }, { - "cid": "bafyreifq22zqplhdxr2rvuanegqw6ogaur46f5ud3upp7p2dw7tt6vozpa", + "cid": "bafyreibqvl2lwj3icgbg7rconymk5pmnpzr6htvd37qw4fmawe7bxvpuse", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_cid_test.go b/tests/integration/query/commits/with_doc_id_cid_test.go index 9e1972e391..493f07b477 100644 --- a/tests/integration/query/commits/with_doc_id_cid_test.go +++ b/tests/integration/query/commits/with_doc_id_cid_test.go @@ -103,15 +103,15 @@ func TestQueryCommitsWithDocIDAndCidWithUpdate(t *testing.T) { testUtils.Request{ Request: ` { commits( - docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", - cid: "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4" + docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", + cid: "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba" ) { cid } }`, Results: []map[string]any{ { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_count_test.go b/tests/integration/query/commits/with_doc_id_count_test.go index ef4dc103bf..11034ac09f 100644 --- a/tests/integration/query/commits/with_doc_id_count_test.go +++ b/tests/integration/query/commits/with_doc_id_count_test.go @@ -30,22 +30,22 @@ func TestQueryCommitsWithDocIDAndLinkCount(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid _count(field: links) } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "_count": 0, }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "_count": 0, }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "_count": 2, }, }, diff --git a/tests/integration/query/commits/with_doc_id_field_test.go b/tests/integration/query/commits/with_doc_id_field_test.go index 4d0e838be7..702f4cc93b 100644 --- a/tests/integration/query/commits/with_doc_id_field_test.go +++ b/tests/integration/query/commits/with_doc_id_field_test.go @@ -30,7 +30,7 @@ func TestQueryCommitsWithDocIDAndUnknownField(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "not a field") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "not a field") { cid } }`, @@ -56,7 +56,7 @@ func TestQueryCommitsWithDocIDAndUnknownFieldId(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "999999") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "999999") { cid } }`, @@ -84,7 +84,7 @@ func TestQueryCommitsWithDocIDAndField(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "Age") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "Age") { cid } }`, @@ -112,13 +112,13 @@ func TestQueryCommitsWithDocIDAndFieldId(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "1") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "1") { cid } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, }, }, @@ -144,13 +144,13 @@ func TestQueryCommitsWithDocIDAndCompositeFieldId(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "C") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "C") { cid } }`, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_group_order_test.go b/tests/integration/query/commits/with_doc_id_group_order_test.go index d858bcf819..5443b4e427 100644 --- a/tests/integration/query/commits/with_doc_id_group_order_test.go +++ b/tests/integration/query/commits/with_doc_id_group_order_test.go @@ -43,10 +43,10 @@ func TestQueryCommitsOrderedAndGroupedByDocID(t *testing.T) { }`, Results: []map[string]any{ { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, { - "docID": "bae-72f3dc53-1846-55d5-915c-28c4e83cc891", + "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_limit_offset_test.go b/tests/integration/query/commits/with_doc_id_limit_offset_test.go index fc2a51da20..42779293c0 100644 --- a/tests/integration/query/commits/with_doc_id_limit_offset_test.go +++ b/tests/integration/query/commits/with_doc_id_limit_offset_test.go @@ -51,16 +51,16 @@ func TestQueryCommitsWithDocIDAndLimitAndOffset(t *testing.T) { }, testUtils.Request{ Request: ` { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", limit: 2, offset: 1) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", limit: 2, offset: 1) { cid } }`, Results: []map[string]any{ { - "cid": "bafyreial53rqep7uoheucc3rzvhs6dbhydnkbqe4w2bhd3hsybub4u3h6m", + "cid": "bafyreicoci4ah2uft5giiyl2lfg4jgcegwbvt3mbllnqnmfh3oy24usxsy", }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_limit_test.go b/tests/integration/query/commits/with_doc_id_limit_test.go index 78bdc100c4..6be85f5339 100644 --- a/tests/integration/query/commits/with_doc_id_limit_test.go +++ b/tests/integration/query/commits/with_doc_id_limit_test.go @@ -44,16 +44,16 @@ func TestQueryCommitsWithDocIDAndLimit(t *testing.T) { }, testUtils.Request{ Request: ` { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", limit: 2) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", limit: 2) { cid } }`, Results: []map[string]any{ { - "cid": "bafyreial53rqep7uoheucc3rzvhs6dbhydnkbqe4w2bhd3hsybub4u3h6m", + "cid": "bafyreicoci4ah2uft5giiyl2lfg4jgcegwbvt3mbllnqnmfh3oy24usxsy", }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go b/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go index cc2663ba1b..c1685e7ad4 100644 --- a/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go +++ b/tests/integration/query/commits/with_doc_id_order_limit_offset_test.go @@ -51,18 +51,18 @@ func TestQueryCommitsWithDocIDAndOrderAndLimitAndOffset(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {height: ASC}, limit: 2, offset: 4) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {height: ASC}, limit: 2, offset: 4) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreial53rqep7uoheucc3rzvhs6dbhydnkbqe4w2bhd3hsybub4u3h6m", + "cid": "bafyreicoci4ah2uft5giiyl2lfg4jgcegwbvt3mbllnqnmfh3oy24usxsy", "height": int64(3), }, }, diff --git a/tests/integration/query/commits/with_doc_id_order_test.go b/tests/integration/query/commits/with_doc_id_order_test.go index 5de3f114b6..f7fb045a1f 100644 --- a/tests/integration/query/commits/with_doc_id_order_test.go +++ b/tests/integration/query/commits/with_doc_id_order_test.go @@ -37,30 +37,30 @@ func TestQueryCommitsWithDocIDAndOrderHeightDesc(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {height: DESC}) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {height: DESC}) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "height": int64(1), }, }, @@ -92,30 +92,30 @@ func TestQueryCommitsWithDocIDAndOrderHeightAsc(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {height: ASC}) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {height: ASC}) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "height": int64(1), }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, }, @@ -147,31 +147,31 @@ func TestQueryCommitsWithDocIDAndOrderCidDesc(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {cid: DESC}) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {cid: DESC}) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", - "height": int64(1), + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", + "height": int64(2), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", - "height": int64(2), + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", + "height": int64(1), }, }, }, @@ -202,31 +202,31 @@ func TestQueryCommitsWithDocIDAndOrderCidAsc(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {cid: ASC}) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {cid: ASC}) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", - "height": int64(2), + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", + "height": int64(1), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", - "height": int64(1), + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", + "height": int64(2), }, }, }, @@ -271,46 +271,46 @@ func TestQueryCommitsWithDocIDAndOrderAndMultiUpdatesCidAsc(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", order: {height: ASC}) { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", order: {height: ASC}) { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "height": int64(1), }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreial53rqep7uoheucc3rzvhs6dbhydnkbqe4w2bhd3hsybub4u3h6m", + "cid": "bafyreicoci4ah2uft5giiyl2lfg4jgcegwbvt3mbllnqnmfh3oy24usxsy", "height": int64(3), }, { - "cid": "bafyreifyknutg2lsajcsqrfegr65t5h5s743jkp3bfuzphx4nmqztfwmga", + "cid": "bafyreichbcwfiwampbb2w2stlrk5yryu5ao4ubz2utybv5fc6qioj3qhu4", "height": int64(3), }, { - "cid": "bafyreiarqxac3gnfrfj3j6fukof375kp56i6jcvgmpfytenczsilx4xkey", + "cid": "bafyreiefwtmw7gtwjmvhapfpq2gmi6j772a6zx5uyyrys6ft4za4oljwfm", "height": int64(4), }, { - "cid": "bafyreihazmfdrwrk3udgnnkuxipcg7cjmzndfazif3t2vxyrq36qwfkrt4", + "cid": "bafyreidde6teqyfjruflxo3yy25rayu7yrxg54siqvloxzqt7o32g2wicy", "height": int64(4), }, }, diff --git a/tests/integration/query/commits/with_doc_id_prop_test.go b/tests/integration/query/commits/with_doc_id_prop_test.go index 6404114217..1d370ab27a 100644 --- a/tests/integration/query/commits/with_doc_id_prop_test.go +++ b/tests/integration/query/commits/with_doc_id_prop_test.go @@ -36,13 +36,13 @@ func TestQueryCommitsWithDocIDProperty(t *testing.T) { }`, Results: []map[string]any{ { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, }, }, diff --git a/tests/integration/query/commits/with_doc_id_test.go b/tests/integration/query/commits/with_doc_id_test.go index 800dad5bfd..e082e6e790 100644 --- a/tests/integration/query/commits/with_doc_id_test.go +++ b/tests/integration/query/commits/with_doc_id_test.go @@ -56,19 +56,19 @@ func TestQueryCommitsWithDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -92,7 +92,7 @@ func TestQueryCommitsWithDocIDAndLinks(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid links { cid @@ -102,22 +102,22 @@ func TestQueryCommitsWithDocIDAndLinks(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "links": []map[string]any{}, }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "links": []map[string]any{}, }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "links": []map[string]any{ { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "name": "name", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "age", }, }, @@ -151,30 +151,30 @@ func TestQueryCommitsWithDocIDAndUpdate(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid height } }`, Results: []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "height": int64(2), }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "height": int64(1), }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "height": int64(1), }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "height": int64(2), }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "height": int64(1), }, }, @@ -209,7 +209,7 @@ func TestQueryCommitsWithDocIDAndUpdateAndLinks(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid links { cid @@ -219,44 +219,44 @@ func TestQueryCommitsWithDocIDAndUpdateAndLinks(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "links": []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "_head", }, }, }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "links": []map[string]any{}, }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "links": []map[string]any{}, }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", "links": []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "name": "_head", }, { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", "name": "age", }, }, }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "links": []map[string]any{ { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "name": "name", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "age", }, }, diff --git a/tests/integration/query/commits/with_doc_id_typename_test.go b/tests/integration/query/commits/with_doc_id_typename_test.go index d15ebba47e..77a58d2fdc 100644 --- a/tests/integration/query/commits/with_doc_id_typename_test.go +++ b/tests/integration/query/commits/with_doc_id_typename_test.go @@ -30,22 +30,22 @@ func TestQueryCommitsWithDocIDWithTypeName(t *testing.T) { }, testUtils.Request{ Request: `query { - commits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + commits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid __typename } }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "__typename": "Commit", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "__typename": "Commit", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "__typename": "Commit", }, }, diff --git a/tests/integration/query/commits/with_field_test.go b/tests/integration/query/commits/with_field_test.go index 6d4922d9b8..15cc2a4cd9 100644 --- a/tests/integration/query/commits/with_field_test.go +++ b/tests/integration/query/commits/with_field_test.go @@ -66,7 +66,7 @@ func TestQueryCommitsWithFieldId(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, }, }, @@ -98,7 +98,7 @@ func TestQueryCommitsWithCompositeFieldId(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -131,7 +131,7 @@ func TestQueryCommitsWithCompositeFieldIdWithReturnedSchemaVersionID(t *testing. }`, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", }, }, diff --git a/tests/integration/query/commits/with_group_test.go b/tests/integration/query/commits/with_group_test.go index f69476a648..fb958ad077 100644 --- a/tests/integration/query/commits/with_group_test.go +++ b/tests/integration/query/commits/with_group_test.go @@ -89,10 +89,10 @@ func TestQueryCommitsWithGroupByHeightWithChild(t *testing.T) { "height": int64(2), "_group": []map[string]any{ { - "cid": "bafyreictnkwvit6jp4mwhai3xp75nvtacxpq6zgbbjm55ylae3t6qshrze", + "cid": "bafyreigurfgpfvcm4uzqxjf4ur3xegxbebn6yoogjrvyaw6x7d2ji6igim", }, { - "cid": "bafyreif3pvxatyqbmwllb7mcxvs734fgfmdkavbu6ambhay37w6vxjzkx4", + "cid": "bafyreif632ewkphjjwxcthemgbkgtm25faw22mvw7eienu5gnazrao33ba", }, }, }, @@ -100,13 +100,13 @@ func TestQueryCommitsWithGroupByHeightWithChild(t *testing.T) { "height": int64(1), "_group": []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", }, }, }, @@ -142,7 +142,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }`, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "_group": []map[string]any{ { "height": int64(1), @@ -150,7 +150,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }, }, { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "_group": []map[string]any{ { "height": int64(1), @@ -158,7 +158,7 @@ func TestQueryCommitsWithGroupByCidWithChild(t *testing.T) { }, }, { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "_group": []map[string]any{ { "height": int64(1), @@ -214,10 +214,10 @@ func TestQueryCommitsWithGroupByDocID(t *testing.T) { }`, Results: []map[string]any{ { - "docID": "bae-72f3dc53-1846-55d5-915c-28c4e83cc891", + "docID": "bae-a839588e-e2e5-5ede-bb91-ffe6871645cb", }, { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, }, }, diff --git a/tests/integration/query/inline_array/with_group_test.go b/tests/integration/query/inline_array/with_group_test.go index a21a34d214..8ab6eb356e 100644 --- a/tests/integration/query/inline_array/with_group_test.go +++ b/tests/integration/query/inline_array/with_group_test.go @@ -86,22 +86,22 @@ func TestQueryInlineArrayWithGroupByArray(t *testing.T) { }, Results: []map[string]any{ { - "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, + "favouriteIntegers": []int64{1, 2, 3}, "_group": []map[string]any{ { - "name": "Andy", - }, - { - - "name": "Shahzad", + "name": "John", }, }, }, { - "favouriteIntegers": []int64{1, 2, 3}, + "favouriteIntegers": []int64{-1, 2, -1, 1, 0}, "_group": []map[string]any{ { - "name": "John", + "name": "Andy", + }, + { + + "name": "Shahzad", }, }, }, diff --git a/tests/integration/query/latest_commits/with_collectionid_prop_test.go b/tests/integration/query/latest_commits/with_collectionid_prop_test.go index 78ffab9b3c..5509671aef 100644 --- a/tests/integration/query/latest_commits/with_collectionid_prop_test.go +++ b/tests/integration/query/latest_commits/with_collectionid_prop_test.go @@ -37,7 +37,7 @@ func TestQueryLastCommitsWithCollectionIdProperty(t *testing.T) { }, testUtils.Request{ Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { collectionID } }`, @@ -49,7 +49,7 @@ func TestQueryLastCommitsWithCollectionIdProperty(t *testing.T) { }, testUtils.Request{ Request: `query { - latestCommits(docID: "bae-de8c99bf-ee0e-5655-8a72-919c2d459a30") { + latestCommits(docID: "bae-f824cbf5-cc66-5e44-a84f-e71f72ff9841") { collectionID } }`, diff --git a/tests/integration/query/latest_commits/with_doc_id_field_test.go b/tests/integration/query/latest_commits/with_doc_id_field_test.go index 624f318c27..300aabbc46 100644 --- a/tests/integration/query/latest_commits/with_doc_id_field_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_field_test.go @@ -22,7 +22,7 @@ func TestQueryLatestCommitsWithDocIDAndFieldName(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple latest commits query with docID and field name", Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "age") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "age") { cid links { cid @@ -50,7 +50,7 @@ func TestQueryLatestCommitsWithDocIDAndFieldId(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple latest commits query with docID and field id", Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "1") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "1") { cid links { cid @@ -68,7 +68,7 @@ func TestQueryLatestCommitsWithDocIDAndFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "links": []map[string]any{}, }, }, @@ -83,7 +83,7 @@ func TestQueryLatestCommitsWithDocIDAndCompositeFieldId(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple latest commits query with docID and composite field id", Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", fieldId: "C") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", fieldId: "C") { cid links { cid @@ -101,14 +101,14 @@ func TestQueryLatestCommitsWithDocIDAndCompositeFieldId(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "links": []map[string]any{ { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "name": "name", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "age", }, }, diff --git a/tests/integration/query/latest_commits/with_doc_id_prop_test.go b/tests/integration/query/latest_commits/with_doc_id_prop_test.go index 247d536532..5cef0f2d06 100644 --- a/tests/integration/query/latest_commits/with_doc_id_prop_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_prop_test.go @@ -30,13 +30,13 @@ func TestQueryLastCommitsWithDocIDProperty(t *testing.T) { }, testUtils.Request{ Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { docID } }`, Results: []map[string]any{ { - "docID": "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7", + "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", }, }, }, diff --git a/tests/integration/query/latest_commits/with_doc_id_test.go b/tests/integration/query/latest_commits/with_doc_id_test.go index 290dea175d..1eea07f6de 100644 --- a/tests/integration/query/latest_commits/with_doc_id_test.go +++ b/tests/integration/query/latest_commits/with_doc_id_test.go @@ -20,7 +20,7 @@ func TestQueryLatestCommitsWithDocID(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple latest commits query with docID", Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid links { cid @@ -38,14 +38,14 @@ func TestQueryLatestCommitsWithDocID(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "links": []map[string]any{ { - "cid": "bafyreidcls23tu7qwp4siw3avyb42eukovpxg6dqifqruvy5wyc6b2ovvq", + "cid": "bafyreidksmyoo6txzmcygby6quhdkzymlqoaxpg75ehlxjdneotjzbih6y", "name": "name", }, { - "cid": "bafyreih5awhipv4pk7truqm3pyyhle7xersbiyzyyacud6c3f7urzutpui", + "cid": "bafyreietqxguz3xlady4gfaqnbeamwsnrwfkufykkpprxej7a77ba7siay", "name": "age", }, }, @@ -60,7 +60,7 @@ func TestQueryLatestCommitsWithDocIDWithSchemaVersionIDField(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple latest commits query with docID and schema versiion id field", Request: `query { - latestCommits(docID: "bae-f54b9689-e06e-5e3a-89b3-f3aee8e64ca7") { + latestCommits(docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3") { cid schemaVersionId } @@ -75,7 +75,7 @@ func TestQueryLatestCommitsWithDocIDWithSchemaVersionIDField(t *testing.T) { }, Results: []map[string]any{ { - "cid": "bafyreid7n6a673spwjwl3ogtuqmrba4i4ntjqvsu4l3spqe6qutdtnqwlq", + "cid": "bafyreichxrfyhajs7rzp3wh5f2zrmt3zkjqan5dmxoy4qno5ozy7omzfpq", "schemaVersionId": "bafkreicprhqxzlw3akyssz2v6pifwfueavp7jq2yj3dghapi3qcq6achs4", }, }, diff --git a/tests/integration/query/one_to_many/simple_test.go b/tests/integration/query/one_to_many/simple_test.go index 63f27c3e17..bf80618d83 100644 --- a/tests/integration/query/one_to_many/simple_test.go +++ b/tests/integration/query/one_to_many/simple_test.go @@ -32,15 +32,15 @@ func TestQueryOneToMany(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, @@ -73,32 +73,32 @@ func TestQueryOneToMany(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -107,6 +107,16 @@ func TestQueryOneToMany(t *testing.T) { }, }, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + }, + }, { "name": "John Grisham", "age": int64(65), @@ -121,16 +131,6 @@ func TestQueryOneToMany(t *testing.T) { }, }, }, - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - }, - }, }, }, } @@ -159,7 +159,7 @@ func TestQueryOneToManyWithNonExistantParent(t *testing.T) { `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, }, diff --git a/tests/integration/query/one_to_many/with_cid_doc_id_test.go b/tests/integration/query/one_to_many/with_cid_doc_id_test.go index a097e6fe29..d335159697 100644 --- a/tests/integration/query/one_to_many/with_cid_doc_id_test.go +++ b/tests/integration/query/one_to_many/with_cid_doc_id_test.go @@ -24,7 +24,7 @@ import ( // Request: `query { // Book ( // cid: "bafybeicgwjdyqyuntdop5ytpsfrqg5a4t2r25pfv6prfppl5ta5k5altca", -// docID: "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" +// docID: "bae-be6d8024-4953-5a92-84b4-f042d25230c6" // ) { // name // author { @@ -34,15 +34,15 @@ import ( // }`, // Docs: map[int][]string{ // //books -// 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d +// 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 // `{ // "name": "Painted House", // "rating": 4.9, -// "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" +// "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" // }`, // }, // //authors -// 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 +// 1: { // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b // `{ // "name": "John Grisham", // "age": 65, @@ -85,16 +85,16 @@ func TestQueryOneToManyWithCidAndDocID(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -104,8 +104,8 @@ func TestQueryOneToManyWithCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Book ( - cid: "bafyreicj6hg76f5hveo5ykaw6kmldtujbmamzyasje6a3gxrro7nlplhba" - docID: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" + cid: "bafyreiauqb3yovbcofeysjckmex5xdzd6ilvspvypk7cqooguimi6kac5e" + docID: "bae-5366ba09-54e8-5381-8169-a770aa9282ae" ) { name author { @@ -154,16 +154,16 @@ func TestQueryOneToManyWithChildUpdateAndFirstCidAndDocID(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -179,8 +179,8 @@ func TestQueryOneToManyWithChildUpdateAndFirstCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Book ( - cid: "bafyreicj6hg76f5hveo5ykaw6kmldtujbmamzyasje6a3gxrro7nlplhba", - docID: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" + cid: "bafyreiauqb3yovbcofeysjckmex5xdzd6ilvspvypk7cqooguimi6kac5e", + docID: "bae-5366ba09-54e8-5381-8169-a770aa9282ae" ) { name author { @@ -227,16 +227,16 @@ func TestQueryOneToManyWithParentUpdateAndFirstCidAndDocID(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -252,8 +252,8 @@ func TestQueryOneToManyWithParentUpdateAndFirstCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Book ( - cid: "bafyreicj6hg76f5hveo5ykaw6kmldtujbmamzyasje6a3gxrro7nlplhba", - docID: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" + cid: "bafyreiauqb3yovbcofeysjckmex5xdzd6ilvspvypk7cqooguimi6kac5e", + docID: "bae-5366ba09-54e8-5381-8169-a770aa9282ae" ) { name rating @@ -300,16 +300,16 @@ func TestQueryOneToManyWithParentUpdateAndLastCidAndDocID(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -325,8 +325,8 @@ func TestQueryOneToManyWithParentUpdateAndLastCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Book ( - cid: "bafyreibom3twkrprkfljn4hh6hyenpzofdwhl2qfrnfa4eljikpyexnn2q", - docID: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" + cid: "bafyreifc646gthndgspdnkftmeaiowwangpfbtm7bpngosfsd72oul5a3u", + docID: "bae-5366ba09-54e8-5381-8169-a770aa9282ae" ) { name rating diff --git a/tests/integration/query/one_to_many/with_count_filter_test.go b/tests/integration/query/one_to_many/with_count_filter_test.go index b367e6c856..4d1a590479 100644 --- a/tests/integration/query/one_to_many/with_count_filter_test.go +++ b/tests/integration/query/one_to_many/with_count_filter_test.go @@ -27,32 +27,32 @@ func TestQueryOneToManyWithCountWithFilter(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -61,14 +61,14 @@ func TestQueryOneToManyWithCountWithFilter(t *testing.T) { }, }, Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 1, - }, { "name": "Cornelia Funke", "_count": 0, }, + { + "name": "John Grisham", + "_count": 1, + }, }, } @@ -89,36 +89,36 @@ func TestQueryOneToManyWithCountWithFilterAndChildFilter(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -128,23 +128,23 @@ func TestQueryOneToManyWithCountWithFilterAndChildFilter(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", - "_count": 2, + "name": "Cornelia Funke", + "_count": 1, "published": []map[string]any{ { - "name": "Painted House", - }, - { - "name": "A Time for Mercy", + "name": "Theif Lord", }, }, }, { - "name": "Cornelia Funke", - "_count": 1, + "name": "John Grisham", + "_count": 2, "published": []map[string]any{ { - "name": "Theif Lord", + "name": "Painted House", + }, + { + "name": "A Time for Mercy", }, }, }, diff --git a/tests/integration/query/one_to_many/with_count_limit_offset_test.go b/tests/integration/query/one_to_many/with_count_limit_offset_test.go index c03e6b3950..838f67434d 100644 --- a/tests/integration/query/one_to_many/with_count_limit_offset_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_offset_test.go @@ -34,38 +34,38 @@ func TestQueryOneToManyWithCountAndLimitAndOffset(t *testing.T) { `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Firm", "rating": 4.1, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Pelican Brief", "rating": 4.0, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -74,23 +74,23 @@ func TestQueryOneToManyWithCountAndLimitAndOffset(t *testing.T) { }, }, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 1, + "published": []map[string]any{}, + }, { "name": "John Grisham", "_count": 4, "published": []map[string]any{ { - "name": "The Pelican Brief", + "name": "Painted House", }, { - "name": "Painted House", + "name": "The Pelican Brief", }, }, }, - { - "name": "Cornelia Funke", - "_count": 1, - "published": []map[string]any{}, - }, }, } @@ -111,37 +111,37 @@ func TestQueryOneToManyWithCountAndDifferentOffsets(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -151,23 +151,23 @@ func TestQueryOneToManyWithCountAndDifferentOffsets(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", - "_count": 2, + "name": "Cornelia Funke", + "_count": 0, "published": []map[string]any{ { - "name": "The Associate", - }, - { - "name": "Painted House", + "name": "Theif Lord", }, }, }, { - "name": "Cornelia Funke", - "_count": 0, + "name": "John Grisham", + "_count": 2, "published": []map[string]any{ { - "name": "Theif Lord", + "name": "The Associate", + }, + { + "name": "Painted House", }, }, }, @@ -188,32 +188,32 @@ func TestQueryOneToManyWithCountWithLimitWithOffset(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -222,14 +222,14 @@ func TestQueryOneToManyWithCountWithLimitWithOffset(t *testing.T) { }, }, Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 1, - }, { "name": "Cornelia Funke", "_count": 0, }, + { + "name": "John Grisham", + "_count": 1, + }, }, } diff --git a/tests/integration/query/one_to_many/with_count_limit_test.go b/tests/integration/query/one_to_many/with_count_limit_test.go index ee282d901f..3badad8ef8 100644 --- a/tests/integration/query/one_to_many/with_count_limit_test.go +++ b/tests/integration/query/one_to_many/with_count_limit_test.go @@ -30,32 +30,32 @@ func TestQueryOneToManyWithCountAndLimit(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -65,20 +65,20 @@ func TestQueryOneToManyWithCountAndLimit(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", - "_count": 2, + "name": "Cornelia Funke", + "_count": 1, "published": []map[string]any{ { - "name": "Painted House", + "name": "Theif Lord", }, }, }, { - "name": "Cornelia Funke", - "_count": 1, + "name": "John Grisham", + "_count": 2, "published": []map[string]any{ { - "name": "Theif Lord", + "name": "Painted House", }, }, }, @@ -102,37 +102,37 @@ func TestQueryOneToManyWithCountAndDifferentLimits(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -142,20 +142,20 @@ func TestQueryOneToManyWithCountAndDifferentLimits(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", - "_count": 2, + "name": "Cornelia Funke", + "_count": 1, "published": []map[string]any{ { - "name": "The Associate", + "name": "Theif Lord", }, }, }, { - "name": "Cornelia Funke", - "_count": 1, + "name": "John Grisham", + "_count": 2, "published": []map[string]any{ { - "name": "Theif Lord", + "name": "The Associate", }, }, }, @@ -176,32 +176,32 @@ func TestQueryOneToManyWithCountWithLimit(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -211,11 +211,11 @@ func TestQueryOneToManyWithCountWithLimit(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", + "name": "Cornelia Funke", "_count": 1, }, { - "name": "Cornelia Funke", + "name": "John Grisham", "_count": 1, }, }, diff --git a/tests/integration/query/one_to_many/with_count_test.go b/tests/integration/query/one_to_many/with_count_test.go index f525e215e3..0efb541d85 100644 --- a/tests/integration/query/one_to_many/with_count_test.go +++ b/tests/integration/query/one_to_many/with_count_test.go @@ -53,32 +53,32 @@ func TestQueryOneToManyWithCount(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -87,14 +87,14 @@ func TestQueryOneToManyWithCount(t *testing.T) { }, }, Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 2, - }, { "name": "Cornelia Funke", "_count": 1, }, + { + "name": "John Grisham", + "_count": 2, + }, }, }, } diff --git a/tests/integration/query/one_to_many/with_doc_id_test.go b/tests/integration/query/one_to_many/with_doc_id_test.go index 34021f53ad..e6e6aa9b90 100644 --- a/tests/integration/query/one_to_many/with_doc_id_test.go +++ b/tests/integration/query/one_to_many/with_doc_id_test.go @@ -23,7 +23,7 @@ func TestQueryOneToManyWithChildDocID(t *testing.T) { Author { name published ( - docID: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" + docID: "bae-5366ba09-54e8-5381-8169-a770aa9282ae" ) { name } @@ -31,20 +31,20 @@ func TestQueryOneToManyWithChildDocID(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d + 0: { // bae-5366ba09-54e8-5381-8169-a770aa9282ae `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, diff --git a/tests/integration/query/one_to_many/with_doc_ids_test.go b/tests/integration/query/one_to_many/with_doc_ids_test.go index 821a24c334..6e61902c79 100644 --- a/tests/integration/query/one_to_many/with_doc_ids_test.go +++ b/tests/integration/query/one_to_many/with_doc_ids_test.go @@ -23,7 +23,7 @@ func TestQueryOneToManyWithChildDocIDs(t *testing.T) { Author { name published ( - docIDs: ["bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca"] + docIDs: ["bae-5366ba09-54e8-5381-8169-a770aa9282ae", "bae-1ccf3043-d760-543e-be1b-6691fa6aa7a8"] ) { name } @@ -32,31 +32,31 @@ func TestQueryOneToManyWithChildDocIDs(t *testing.T) { Docs: map[int][]string{ //books 0: { - // bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d + // bae-5366ba09-54e8-5381-8169-a770aa9282ae `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, - // bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca + // bae-1ccf3043-d760-543e-be1b-6691fa6aa7a8 `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Firm", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, diff --git a/tests/integration/query/one_to_many/with_filter_related_id_test.go b/tests/integration/query/one_to_many/with_filter_related_id_test.go index 98c3af4b59..f2e456143c 100644 --- a/tests/integration/query/one_to_many/with_filter_related_id_test.go +++ b/tests/integration/query/one_to_many/with_filter_related_id_test.go @@ -22,60 +22,60 @@ func TestQueryFromManySideWithEqFilterOnRelatedType(t *testing.T) { Description: "One-to-many query from many side with _eq filter on related field type.", Request: `query { - Book(filter: {author: {_docID: {_eq: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3"}}}) { + Book(filter: {author: {_docID: {_eq: "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b"}}}) { name } }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -99,60 +99,60 @@ func TestQueryFromManySideWithFilterOnRelatedObjectID(t *testing.T) { Description: "One-to-many query from many side with filter on related field.", Request: `query { - Book(filter: {author_id: {_eq: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3"}}) { + Book(filter: {author_id: {_eq: "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b"}}) { name } }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -178,8 +178,8 @@ func TestQueryFromManySideWithSameFiltersInDifferentWayOnRelatedType(t *testing. Request: `query { Book( filter: { - author: {_docID: {_eq: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3"}}, - author_id: {_eq: "bae-41598f0c-19bc-5da6-813b-e80f14a10df3"} + author: {_docID: {_eq: "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b"}}, + author_id: {_eq: "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b"} } ) { name @@ -188,53 +188,53 @@ func TestQueryFromManySideWithSameFiltersInDifferentWayOnRelatedType(t *testing. Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -258,60 +258,60 @@ func TestQueryFromSingleSideWithEqFilterOnRelatedType(t *testing.T) { Description: "One-to-many query from single side with _eq filter on related field type.", Request: `query { - Author(filter: {published: {_docID: {_eq: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d"}}}) { + Author(filter: {published: {_docID: {_eq: "bae-96c9de0f-2903-5589-9604-b42882afde8c"}}}) { name } }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -335,60 +335,60 @@ func TestQueryFromSingleSideWithFilterOnRelatedObjectID_Error(t *testing.T) { Description: "One-to-many query from single side with filter on related field.", Request: `query { - Author(filter: {published_id: {_eq: "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d"}}) { + Author(filter: {published_id: {_eq: "bae-5366ba09-54e8-5381-8169-a770aa9282ae"}}) { name } }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -397,7 +397,7 @@ func TestQueryFromSingleSideWithFilterOnRelatedObjectID_Error(t *testing.T) { }, }, - ExpectedError: "Argument \"filter\" has invalid value {published_id: {_eq: \"bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d\"}}.\nIn field \"published_id\": Unknown field.", + ExpectedError: "Argument \"filter\" has invalid value {published_id: {_eq: \"bae-5366ba09-54e8-5381-8169-a770aa9282ae\"}}.\nIn field \"published_id\": Unknown field.", } executeTestCase(t, test) diff --git a/tests/integration/query/one_to_many/with_filter_test.go b/tests/integration/query/one_to_many/with_filter_test.go index ce019f2afa..94c971c7a8 100644 --- a/tests/integration/query/one_to_many/with_filter_test.go +++ b/tests/integration/query/one_to_many/with_filter_test.go @@ -25,11 +25,11 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -37,7 +37,7 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { Doc: `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -45,12 +45,12 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { Doc: `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -59,7 +59,7 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -109,11 +109,11 @@ func TestQueryOneToManyWithNumericGreaterThanChildFilterOnParentWithUnrenderedCh }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -121,7 +121,7 @@ func TestQueryOneToManyWithNumericGreaterThanChildFilterOnParentWithUnrenderedCh Doc: `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -129,12 +129,12 @@ func TestQueryOneToManyWithNumericGreaterThanChildFilterOnParentWithUnrenderedCh Doc: `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -143,7 +143,7 @@ func TestQueryOneToManyWithNumericGreaterThanChildFilterOnParentWithUnrenderedCh }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -177,11 +177,11 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndChild(t *testing.T }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -189,7 +189,7 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndChild(t *testing.T Doc: `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -197,12 +197,12 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndChild(t *testing.T Doc: `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -211,7 +211,7 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndChild(t *testing.T }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -257,11 +257,11 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -269,7 +269,7 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { Doc: `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -277,12 +277,12 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { Doc: `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -291,7 +291,7 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -314,6 +314,17 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { } }`, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "p1": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + }, + "p2": []map[string]any{}, + }, { "name": "John Grisham", "age": int64(65), @@ -330,17 +341,6 @@ func TestQueryOneToManyWithMultipleAliasedFilteredChildren(t *testing.T) { }, }, }, - { - "name": "Cornelia Funke", - "age": int64(62), - "p1": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - }, - "p2": []map[string]any{}, - }, }, }, }, @@ -361,7 +361,7 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { Doc: `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -369,7 +369,7 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { Doc: `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, testUtils.CreateDoc{ @@ -377,7 +377,7 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { Doc: `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, testUtils.CreateDoc{ @@ -385,12 +385,12 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { Doc: `{ "name": "The Lord of the Rings", "rating": 5.0, - "author_id": "bae-61d279c1-eab9-56ec-8654-dce0324ebfda" + "author_id": "bae-6bf29c1c-7112-5f4f-bfae-1c039479acf6" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b Doc: `{ "name": "John Grisham", "age": 65, @@ -399,7 +399,7 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -408,7 +408,7 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-61d279c1-eab9-56ec-8654-dce0324ebfda + // bae-6bf29c1c-7112-5f4f-bfae-1c039479acf6 Doc: `{ "name": "John Tolkien", "age": 70, @@ -432,10 +432,10 @@ func TestQueryOneToManyWithCompoundOperatorInFilterAndRelation(t *testing.T) { }`, Results: []map[string]any{ { - "name": "John Grisham", + "name": "Cornelia Funke", }, { - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, @@ -464,41 +464,8 @@ func TestQueryOneToMany_WithCompoundOperatorInFilterAndRelationAndCaseInsensitiv testUtils.SchemaUpdate{ Schema: bookAuthorGQLSchema, }, - testUtils.CreateDoc{ - CollectionID: 0, - Doc: `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - }, - testUtils.CreateDoc{ - CollectionID: 0, - Doc: `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - }, - testUtils.CreateDoc{ - CollectionID: 0, - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - }, - testUtils.CreateDoc{ - CollectionID: 0, - Doc: `{ - "name": "The Lord of the Rings", - "rating": 5.0, - "author_id": "bae-61d279c1-eab9-56ec-8654-dce0324ebfda" - }`, - }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 Doc: `{ "name": "John Grisham", "age": 65, @@ -507,7 +474,6 @@ func TestQueryOneToMany_WithCompoundOperatorInFilterAndRelationAndCaseInsensitiv }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -516,13 +482,44 @@ func TestQueryOneToMany_WithCompoundOperatorInFilterAndRelationAndCaseInsensitiv }, testUtils.CreateDoc{ CollectionID: 1, - // bae-61d279c1-eab9-56ec-8654-dce0324ebfda Doc: `{ "name": "John Tolkien", "age": 70, "verified": true }`, }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Lord of the Rings", + "rating": 5.0, + "author_id": testUtils.NewDocIndex(1, 2), + }, + }, testUtils.Request{ Request: `query { Author(filter: {_or: [ @@ -540,10 +537,10 @@ func TestQueryOneToMany_WithCompoundOperatorInFilterAndRelationAndCaseInsensitiv }`, Results: []map[string]any{ { - "name": "John Grisham", + "name": "Cornelia Funke", }, { - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_filter_test.go b/tests/integration/query/one_to_many/with_group_filter_test.go index 05e5b1c573..6005ef2def 100644 --- a/tests/integration/query/one_to_many/with_group_filter_test.go +++ b/tests/integration/query/one_to_many/with_group_filter_test.go @@ -34,53 +34,53 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnJoin(t *testing }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -92,10 +92,6 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnJoin(t *testing { "age": int64(327), "_group": []map[string]any{ - { - "name": "Simon Pelloutier", - "published": []map[string]any{}, - }, { "name": "Voltaire", "published": []map[string]any{ @@ -109,6 +105,10 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnJoin(t *testing }, }, }, + { + "name": "Simon Pelloutier", + "published": []map[string]any{}, + }, }, }, { @@ -152,53 +152,53 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroup(t *testin }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -274,53 +274,53 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroupAndOnGroup }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -332,10 +332,6 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroupAndOnGroup { "age": int64(327), "_group": []map[string]any{ - { - "name": "Simon Pelloutier", - "published": []map[string]any{}, - }, { "name": "Voltaire", "published": []map[string]any{ @@ -345,6 +341,10 @@ func TestQueryOneToManyWithParentJoinGroupNumberAndNumberFilterOnGroupAndOnGroup }, }, }, + { + "name": "Simon Pelloutier", + "published": []map[string]any{}, + }, }, }, }, diff --git a/tests/integration/query/one_to_many/with_group_related_id_alias_test.go b/tests/integration/query/one_to_many/with_group_related_id_alias_test.go index bef01aee48..fdd50743c4 100644 --- a/tests/integration/query/one_to_many/with_group_related_id_alias_test.go +++ b/tests/integration/query/one_to_many/with_group_related_id_alias_test.go @@ -16,142 +16,174 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -// TODO: Don't return grouped field if not selected. [https://github.com/sourcenetwork/defradb/issues/1582]. func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAlias(t *testing.T) { - test := testUtils.RequestTestCase{ - + test := testUtils.TestCase{ Description: "One-to-many query with groupBy on related field alias (from many side).", - - Request: `query { - Book(groupBy: [author]) { - author_id - _group { - name - rating - author { - name - age + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author } - } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Client", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Candide", - "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Zadig", - "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" - }`, + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Simon Pelloutier", "age": 327, "verified": true }`, }, - }, - Results: []map[string]any{ - { - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), }, }, - { - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", - }, - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Client", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Candide", + "rating": 4.95, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Zadig", + "rating": 4.91, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2, + "author_id": testUtils.NewDocIndex(1, 2), + }, + }, + testUtils.Request{ + Request: `query { + Book(groupBy: [author]) { + author_id + _group { + name + rating + author { + name + age + } + } + } + }`, + Results: []map[string]any{ { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, }, }, { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, + }, }, }, - }, - }, - { - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", - "_group": []map[string]any{ { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, }, }, }, @@ -159,157 +191,189 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAlias(t *t }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } -// TODO: Don't return grouped field if not selected. [https://github.com/sourcenetwork/defradb/issues/1582]. func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAliasAndRelatedSelection(t *testing.T) { - test := testUtils.RequestTestCase{ - + test := testUtils.TestCase{ Description: "One-to-many query with groupBy on related field alias (from many side).", - - Request: `query { - Book(groupBy: [author]) { - author { - _docID - name - } - _group { - name - rating - author { - name - age + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author } - } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Client", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Candide", - "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Zadig", - "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" - }`, + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Simon Pelloutier", "age": 327, "verified": true }`, }, - }, - Results: []map[string]any{ - { - "author": map[string]any{ - "name": "Voltaire", - "_docID": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), }, - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), }, }, - { - "author": map[string]any{ - "name": "John Grisham", - "_docID": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Client", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), }, - "_group": []map[string]any{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Candide", + "rating": 4.95, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Zadig", + "rating": 4.91, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2, + "author_id": testUtils.NewDocIndex(1, 2), + }, + }, + testUtils.Request{ + Request: `query { + Book(groupBy: [author]) { + author { + _docID + name + } + _group { + name + rating + author { + name + age + } + } + } + }`, + Results: []map[string]any{ { - "name": "The Client", - "rating": 4.5, "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "name": "John Grisham", + "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, }, }, { - "name": "A Time for Mercy", - "rating": 4.5, "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "name": "Simon Pelloutier", + "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + }, + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, + }, }, }, - }, - }, - { - "author": map[string]any{ - "name": "Simon Pelloutier", - "_docID": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", - }, - "_group": []map[string]any{ { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + "name": "Voltaire", + "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + }, + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, }, }, }, @@ -317,144 +381,177 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromManySideUsingAliasAndRe }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySideUsingAlias(t *testing.T) { - test := testUtils.RequestTestCase{ - + test := testUtils.TestCase{ Description: "One-to-many query with groupBy on related field alias, with id selection & related selection (from many side).", - - Request: `query { - Book(groupBy: [author]) { - author_id - _group { - name - rating - author { - name - age + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author } - } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Client", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Candide", - "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Zadig", - "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" - }`, + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Simon Pelloutier", "age": 327, "verified": true }`, }, - }, - Results: []map[string]any{ - { - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), }, }, - { - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "_group": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", - }, - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Client", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Candide", + "rating": 4.95, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Zadig", + "rating": 4.91, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2, + "author_id": testUtils.NewDocIndex(1, 2), + }, + }, + testUtils.Request{ + Request: `query { + Book(groupBy: [author]) { + author_id + _group { + name + rating + author { + name + age + } + } + } + }`, + Results: []map[string]any{ { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, }, }, { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, + }, }, }, - }, - }, - { - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", - "_group": []map[string]any{ { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, - "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, }, }, }, @@ -462,160 +559,193 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySide }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySideUsingAliasAndRelatedSelection(t *testing.T) { - test := testUtils.RequestTestCase{ - + test := testUtils.TestCase{ Description: "One-to-many query with groupBy on related field alias, with id selection & related selection (from many side).", - - Request: `query { - Book(groupBy: [author]) { - author_id - author { - _docID - name - } - _group { - name - rating - author { - name - age + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author } - } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Client", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Candide", - "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Zadig", - "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" - }`, - `{ - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" - }`, + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Simon Pelloutier", "age": 327, "verified": true }`, }, - }, - Results: []map[string]any{ - { - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", - "author": map[string]any{ - "name": "Voltaire", - "_docID": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), }, - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), }, }, - { - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "author": map[string]any{ - "name": "John Grisham", - "_docID": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Client", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), }, - "_group": []map[string]any{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Candide", + "rating": 4.95, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Zadig", + "rating": 4.91, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2, + "author_id": testUtils.NewDocIndex(1, 2), + }, + }, + testUtils.Request{ + Request: `query { + Book(groupBy: [author]) { + author_id + author { + _docID + name + } + _group { + name + rating + author { + name + age + } + } + } + }`, + Results: []map[string]any{ { - "name": "The Client", - "rating": 4.5, + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "name": "John Grisham", + "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, - }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "_group": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "age": int64(65), + "name": "John Grisham", + }, + }, }, }, { - "name": "A Time for Mercy", - "rating": 4.5, + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", "author": map[string]any{ - "age": int64(65), - "name": "John Grisham", + "name": "Simon Pelloutier", + "_docID": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", + }, + "_group": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": 2.0, + "author": map[string]any{ + "age": int64(327), + "name": "Simon Pelloutier", + }, + }, }, }, - }, - }, - { - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", - "author": map[string]any{ - "name": "Simon Pelloutier", - "_docID": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", - }, - "_group": []map[string]any{ { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": 2.0, + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", "author": map[string]any{ - "age": int64(327), - "name": "Simon Pelloutier", + "name": "Voltaire", + "_docID": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + }, + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, }, }, }, @@ -623,10 +753,9 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromManySide }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } -// TODO: Don't return grouped field if not selected. [https://github.com/sourcenetwork/defradb/issues/1582]. func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromSingleSideUsingAlias(t *testing.T) { test := testUtils.RequestTestCase{ Description: "One-to-many query with groupBy on related id field alias (from single side).", @@ -639,53 +768,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromSingleSideUsingAlias(t }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -713,53 +842,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromSingleSi }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, diff --git a/tests/integration/query/one_to_many/with_group_related_id_test.go b/tests/integration/query/one_to_many/with_group_related_id_test.go index 4eec467480..673ccfddad 100644 --- a/tests/integration/query/one_to_many/with_group_related_id_test.go +++ b/tests/integration/query/one_to_many/with_group_related_id_test.go @@ -16,7 +16,6 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -// TODO: Don't return grouped field if not selected. [https://github.com/sourcenetwork/defradb/issues/1582]. func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T) { test := testUtils.RequestTestCase{ Description: "One-to-many query with groupBy on related id (from many side).", @@ -35,53 +34,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -91,28 +90,7 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T }, Results: []map[string]any{ { - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - }, - }, - { - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", "_group": []map[string]any{ { "name": "The Client", @@ -141,7 +119,7 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T }, }, { - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", "_group": []map[string]any{ { "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", @@ -153,6 +131,27 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDFromManySide(t *testing.T }, }, }, + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + }, + }, }, } @@ -177,53 +176,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDWithIDSelectionFromManySi }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -233,28 +232,7 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDWithIDSelectionFromManySi }, Results: []map[string]any{ { - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", - "_group": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - { - "name": "Zadig", - "rating": 4.91, - "author": map[string]any{ - "age": int64(327), - "name": "Voltaire", - }, - }, - }, - }, - { - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", "_group": []map[string]any{ { "name": "The Client", @@ -283,7 +261,7 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDWithIDSelectionFromManySi }, }, { - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", "_group": []map[string]any{ { "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", @@ -295,13 +273,33 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeIDWithIDSelectionFromManySi }, }, }, + { + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", + "_group": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + { + "name": "Zadig", + "rating": 4.91, + "author": map[string]any{ + "age": int64(327), + "name": "Voltaire", + }, + }, + }, + }, }, } executeTestCase(t, test) } -// TODO: Don't return grouped field if not selected. [https://github.com/sourcenetwork/defradb/issues/1582]. func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromSingleSide(t *testing.T) { test := testUtils.RequestTestCase{ Description: "One-to-many query with groupBy on related id (from single side).", @@ -318,53 +316,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeFromSingleSide(t *testing.T }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -396,53 +394,53 @@ func TestQueryOneToManyWithParentGroupByOnRelatedTypeWithIDSelectionFromSingleSi }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, diff --git a/tests/integration/query/one_to_many/with_group_test.go b/tests/integration/query/one_to_many/with_group_test.go index b56a6f5cea..0cb74a4492 100644 --- a/tests/integration/query/one_to_many/with_group_test.go +++ b/tests/integration/query/one_to_many/with_group_test.go @@ -34,37 +34,37 @@ func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -73,6 +73,20 @@ func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { }, }, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "rating": 4.8, + "_group": []map[string]any{ + { + "name": "Theif Lord", + }, + }, + }, + }, + }, { "name": "John Grisham", "age": int64(65), @@ -98,20 +112,6 @@ func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { }, }, }, - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "rating": 4.8, - "_group": []map[string]any{ - { - "name": "Theif Lord", - }, - }, - }, - }, - }, }, }, } @@ -122,10 +122,9 @@ func TestQueryOneToManyWithInnerJoinGroupNumber(t *testing.T) { } func TestQueryOneToManyWithParentJoinGroupNumber(t *testing.T) { - tests := []testUtils.RequestTestCase{ - { - Description: "One-to-many relation query from many side with parent level group", - Request: `query { + test := testUtils.RequestTestCase{ + Description: "One-to-many relation query from many side with parent level group", + Request: `query { Author (groupBy: [age]) { age _group { @@ -137,108 +136,107 @@ func TestQueryOneToManyWithParentJoinGroupNumber(t *testing.T) { } } }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ + Docs: map[int][]string{ + //books + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 + `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, - `{ + `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, - `{ + `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, - `{ + `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, - `{ + `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, - `{ + `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, - }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + }, + //authors + 1: { + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b + `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 - `{ + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c + `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c - `{ + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 + `{ "name": "Simon Pelloutier", "age": 327, "verified": true }`, - }, }, - Results: []map[string]any{ - { - "age": int64(327), - "_group": []map[string]any{ - { - "name": "Simon Pelloutier", - "published": []map[string]any{ - { - "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "rating": float64(2), - }, + }, + Results: []map[string]any{ + { + "age": int64(327), + "_group": []map[string]any{ + { + "name": "Voltaire", + "published": []map[string]any{ + { + "name": "Candide", + "rating": 4.95, + }, + { + "name": "Zadig", + "rating": 4.91, }, }, - { - "name": "Voltaire", - "published": []map[string]any{ - { - "name": "Candide", - "rating": 4.95, - }, - { - "name": "Zadig", - "rating": 4.91, - }, + }, + { + "name": "Simon Pelloutier", + "published": []map[string]any{ + { + "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", + "rating": float64(2), }, }, }, }, - { - "age": int64(65), - "_group": []map[string]any{ - { - "name": "John Grisham", - "published": []map[string]any{ - { - "name": "The Client", - "rating": 4.5, - }, - { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - }, + }, + { + "age": int64(65), + "_group": []map[string]any{ + { + "name": "John Grisham", + "published": []map[string]any{ + { + "name": "The Client", + "rating": 4.5, + }, + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, }, }, }, @@ -247,9 +245,7 @@ func TestQueryOneToManyWithParentJoinGroupNumber(t *testing.T) { }, } - for _, test := range tests { - executeTestCase(t, test) - } + executeTestCase(t, test) } func TestQueryOneToManyWithInnerJoinGroupNumberWithNonGroupFieldsSelected(t *testing.T) { diff --git a/tests/integration/query/one_to_many/with_limit_test.go b/tests/integration/query/one_to_many/with_limit_test.go index 297fd56896..6b518de6e1 100644 --- a/tests/integration/query/one_to_many/with_limit_test.go +++ b/tests/integration/query/one_to_many/with_limit_test.go @@ -30,32 +30,32 @@ func TestQueryOneToManyWithSingleChildLimit(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -65,20 +65,20 @@ func TestQueryOneToManyWithSingleChildLimit(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", + "name": "Cornelia Funke", "published": []map[string]any{ { - "name": "Painted House", - "rating": 4.9, + "name": "Theif Lord", + "rating": 4.8, }, }, }, { - "name": "Cornelia Funke", + "name": "John Grisham", "published": []map[string]any{ { - "name": "Theif Lord", - "rating": 4.8, + "name": "Painted House", + "rating": 4.9, }, }, }, @@ -106,32 +106,32 @@ func TestQueryOneToManyWithMultipleChildLimits(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -141,36 +141,36 @@ func TestQueryOneToManyWithMultipleChildLimits(t *testing.T) { }, Results: []map[string]any{ { - "name": "John Grisham", + "name": "Cornelia Funke", "p1": []map[string]any{ { - "name": "Painted House", - "rating": 4.9, + "name": "Theif Lord", + "rating": 4.8, }, }, "p2": []map[string]any{ { - "name": "Painted House", - "rating": 4.9, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, + "name": "Theif Lord", + "rating": 4.8, }, }, }, { - "name": "Cornelia Funke", + "name": "John Grisham", "p1": []map[string]any{ { - "name": "Theif Lord", - "rating": 4.8, + "name": "Painted House", + "rating": 4.9, }, }, "p2": []map[string]any{ { - "name": "Theif Lord", - "rating": 4.8, + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, }, }, }, diff --git a/tests/integration/query/one_to_many/with_order_filter_limit_test.go b/tests/integration/query/one_to_many/with_order_filter_limit_test.go index 8acee4db18..46c27c474e 100644 --- a/tests/integration/query/one_to_many/with_order_filter_limit_test.go +++ b/tests/integration/query/one_to_many/with_order_filter_limit_test.go @@ -33,32 +33,32 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendi }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -100,32 +100,32 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortDescend }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, diff --git a/tests/integration/query/one_to_many/with_order_filter_test.go b/tests/integration/query/one_to_many/with_order_filter_test.go index a7de6d5977..225d25a7f4 100644 --- a/tests/integration/query/one_to_many/with_order_filter_test.go +++ b/tests/integration/query/one_to_many/with_order_filter_test.go @@ -37,28 +37,28 @@ func TestQueryOneToManyWithNumericGreaterThanFilterOnParentAndNumericSortAscendi `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -102,32 +102,32 @@ func TestQueryOneToManyWithNumericGreaterThanFilterAndNumericSortDescendingOnChi }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -136,6 +136,16 @@ func TestQueryOneToManyWithNumericGreaterThanFilterAndNumericSortDescendingOnChi }, }, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "age": int64(62), + "published": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + }, + }, { "name": "John Grisham", "age": int64(65), @@ -150,16 +160,6 @@ func TestQueryOneToManyWithNumericGreaterThanFilterAndNumericSortDescendingOnChi }, }, }, - { - "name": "Cornelia Funke", - "age": int64(62), - "published": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - }, - }, }, } diff --git a/tests/integration/query/one_to_many/with_related_id_test.go b/tests/integration/query/one_to_many/with_related_id_test.go index bcfef26cfe..8626ffddd9 100644 --- a/tests/integration/query/one_to_many/with_related_id_test.go +++ b/tests/integration/query/one_to_many/with_related_id_test.go @@ -30,54 +30,54 @@ func TestQueryOneToManyWithRelatedTypeIDFromManySide(t *testing.T) { Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, @@ -88,28 +88,28 @@ func TestQueryOneToManyWithRelatedTypeIDFromManySide(t *testing.T) { Results: []map[string]any{ { - "name": "Candide", - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", + "name": "The Client", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, { - "name": "Zadig", - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3", + "name": "Painted House", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, { - "name": "The Client", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "name": "A Time for Mercy", + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", }, { "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c", + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614", }, { - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "name": "Candide", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", }, { - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "name": "Zadig", + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c", }, }, } @@ -131,54 +131,54 @@ func TestQueryOneToManyWithRelatedTypeIDFromSingleSide(t *testing.T) { Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Client", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Candide", "rating": 4.95, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Zadig", "rating": 4.91, - "author_id": "bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3" + "author_id": "bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c" }`, `{ "name": "Histoiare des Celtes et particulierement des Gaulois et des Germains depuis les temps fabuleux jusqua la prise de Roze par les Gaulois", "rating": 2, - "author_id": "bae-09d33399-197a-5b98-b135-4398f2b6de4c" + "author_id": "bae-34a9bd41-1f0d-5748-8446-48fc36ef2614" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-7accaba8-ea9d-54b1-92f4-4a7ac5de88b3 + // bae-1594d2aa-d63c-51d2-8e5e-06ee0c9e2e8c `{ "name": "Voltaire", "age": 327, "verified": true }`, - // bae-09d33399-197a-5b98-b135-4398f2b6de4c + // bae-34a9bd41-1f0d-5748-8446-48fc36ef2614 `{ "name": "Simon Pelloutier", "age": 327, diff --git a/tests/integration/query/one_to_many/with_same_field_name_test.go b/tests/integration/query/one_to_many/with_same_field_name_test.go index dfc609518b..10136ae529 100644 --- a/tests/integration/query/one_to_many/with_same_field_name_test.go +++ b/tests/integration/query/one_to_many/with_same_field_name_test.go @@ -46,14 +46,14 @@ func TestQueryOneToManyWithSameFieldName(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-9217906d-e8c5-533d-8520-71c754590844 + 0: { `{ "name": "Painted House", - "relationship1_id": "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + "relationship1_id": "bae-ee5973cf-73c3-558f-8aec-8b590b8e77cf" }`, }, //authors - 1: { // bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed + 1: { // bae-ee5973cf-73c3-558f-8aec-8b590b8e77cf `{ "name": "John Grisham" }`, @@ -80,14 +80,14 @@ func TestQueryOneToManyWithSameFieldName(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-9217906d-e8c5-533d-8520-71c754590844 + 0: { `{ "name": "Painted House", - "relationship1_id": "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" + "relationship1_id": "bae-ee5973cf-73c3-558f-8aec-8b590b8e77cf" }`, }, //authors - 1: { // bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed + 1: { // bae-ee5973cf-73c3-558f-8aec-8b590b8e77cf `{ "name": "John Grisham" }`, diff --git a/tests/integration/query/one_to_many/with_sum_filter_order_test.go b/tests/integration/query/one_to_many/with_sum_filter_order_test.go index af01cdb8b1..96f2c14fc1 100644 --- a/tests/integration/query/one_to_many/with_sum_filter_order_test.go +++ b/tests/integration/query/one_to_many/with_sum_filter_order_test.go @@ -28,47 +28,47 @@ func TestOneToManyAscOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing.T Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -93,7 +93,7 @@ func TestOneToManyAscOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing.T }, { "name": "John Grisham", - "_sum": 20.799999999999997, + "_sum": 20.8, }, { "name": "Not a Writer", @@ -117,47 +117,47 @@ func TestOneToManyDescOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing. Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -182,7 +182,7 @@ func TestOneToManyDescOrderAndFilterOnParentWithAggSumOnSubTypeField(t *testing. }, { "name": "John Grisham", - "_sum": 20.799999999999997, + "_sum": 20.8, }, { "name": "Cornelia Funke", @@ -207,47 +207,47 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithDescOrderingOnFieldWi Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -276,16 +276,16 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithDescOrderingOnFieldWi "sum1": 0.0, "sum2": 0.0, }, - { - "name": "John Grisham", - "sum1": 20.799999999999997, - "sum2": 4.9 + 4.5, - }, { "name": "Cornelia Funke", "sum1": 4.8, "sum2": 4.8, }, + { + "name": "John Grisham", + "sum1": 20.8, + "sum2": 4.9 + 4.5, + }, }, } @@ -305,47 +305,47 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithAscOrderingOnFieldWit Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -374,16 +374,16 @@ func TestOnetoManySumBySubTypeFieldAndSumBySybTypeFieldWithAscOrderingOnFieldWit "sum1": 0.0, "sum2": 0.0, }, - { - "name": "John Grisham", - "sum1": 20.799999999999997, - "sum2": 4.0 + 3.2, - }, { "name": "Cornelia Funke", "sum1": 4.8, "sum2": 4.8, }, + { + "name": "John Grisham", + "sum1": 20.8, + "sum2": 4.0 + 3.2, + }, }, } @@ -404,47 +404,47 @@ func TestOneToManyLimitAscOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *te Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -472,21 +472,21 @@ func TestOneToManyLimitAscOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *te "LimitOrderFields": []map[string]any{}, }, { - "LimitOrderSum": 3.2 + 4.0, + "LimitOrderSum": 4.8, "LimitOrderFields": []map[string]any{ { - "name": "Sooley", - }, - { - "name": "The Rooster Bar", + "name": "Theif Lord", }, }, }, { - "LimitOrderSum": 4.8, + "LimitOrderSum": 3.2 + 4.0, "LimitOrderFields": []map[string]any{ { - "name": "Theif Lord", + "name": "Sooley", + }, + { + "name": "The Rooster Bar", }, }, }, @@ -510,47 +510,47 @@ func TestOneToManyLimitDescOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *t Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Sooley", "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Rooster Bar", "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -578,21 +578,21 @@ func TestOneToManyLimitDescOrderSumOfSubTypeAndLimitAscOrderFieldsOfSubtype(t *t "LimitOrderFields": []map[string]any{}, }, { - "LimitOrderSum": 4.9 + 4.5, + "LimitOrderSum": 4.8, "LimitOrderFields": []map[string]any{ { - "name": "Painted House", - }, - { - "name": "A Time for Mercy", + "name": "Theif Lord", }, }, }, { - "LimitOrderSum": 4.8, + "LimitOrderSum": 4.9 + 4.5, "LimitOrderFields": []map[string]any{ { - "name": "Theif Lord", + "name": "Painted House", + }, + { + "name": "A Time for Mercy", }, }, }, diff --git a/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go b/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go index 11df5b310c..e7c4606071 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_offset_order_test.go @@ -17,398 +17,568 @@ import ( ) func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderAsc(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum with limit and offset and order", - Request: `query { - Author { - name - _sum(published: {field: rating, offset: 1, limit: 2, order: {name: ASC}}) - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - // 4.9 + 3.2 - // ...00001 is float math artifact - "_sum": 8.100000000000001, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, }, - { - "name": "Cornelia Funke", - "_sum": float64(0), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _sum(published: {field: rating, offset: 1, limit: 2, order: {name: ASC}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + }, + { + "name": "John Grisham", + // 4.9 + 3.2 + // ...00001 is float math artifact + "_sum": 8.100000000000001, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderDesc(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum with limit and offset and order", - Request: `query { - Author { - name - _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - // 4.2 + 3.2 - "_sum": 7.4, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, }, - { - "name": "Cornelia Funke", - "_sum": float64(0), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": float64(0), + }, + { + "name": "John Grisham", + // 4.2 + 3.2 + "_sum": 7.4, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderAscAndDesc(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum with limit and offset and order", - Request: `query { - Author { - name - asc: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: ASC}}) - desc: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - // 4.9 + 3.2 - // ...00001 is float math artifact - "asc": 8.100000000000001, - // 4.2 + 3.2 - "desc": 7.4, - }, - { - "name": "Cornelia Funke", - "asc": float64(0), - "desc": float64(0), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + asc: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: ASC}}) + desc: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "asc": float64(0), + "desc": float64(0), + }, + { + "name": "John Grisham", + // 4.9 + 3.2 + // ...00001 is float math artifact + "asc": 8.100000000000001, + // 4.2 + 3.2 + "desc": 7.4, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderOnDifferentFields(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum with limit and offset and order", - Request: `query { - Author { - name - byName: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) - byRating: _sum(published: {field: rating, offset: 1, limit: 2, order: {rating: DESC}}) - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - // 4.2 + 3.2 - "byName": 7.4, - // 4.5 + 4.2 - "byRating": 8.7, - }, - { - "name": "Cornelia Funke", - "byName": float64(0), - "byRating": float64(0), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + byName: _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) + byRating: _sum(published: {field: rating, offset: 1, limit: 2, order: {rating: DESC}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "byName": float64(0), + "byRating": float64(0), + }, + { + "name": "John Grisham", + // 4.2 + 3.2 + "byName": 7.4, + // 4.5 + 4.2 + "byRating": 8.7, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyWithSumWithLimitWithOffsetWithOrderDescAndRenderedChildrenOrderedAsc(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum with limit and offset and order", - Request: `query { - Author { - name - _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) - published(offset: 1, limit: 2, order: {name: ASC}) { - name + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + + type Author { + name: String + age: Int + verified: Boolean + published: [Book] + } + `, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - // 4.2 + 3.2 - "_sum": 7.4, - "published": []map[string]any{ + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _sum(published: {field: rating, offset: 1, limit: 2, order: {name: DESC}}) + published(offset: 1, limit: 2, order: {name: ASC}) { + name + } + } + }`, + Results: []map[string]any{ { - "name": "Painted House", + "name": "Cornelia Funke", + "_sum": float64(0), + "published": []map[string]any{}, }, { - "name": "Sooley", + "name": "John Grisham", + // 4.2 + 3.2 + "_sum": 7.4, + "published": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "Sooley", + }, + }, }, }, }, - { - "name": "Cornelia Funke", - "_sum": float64(0), - "published": []map[string]any{}, - }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many/with_sum_limit_offset_test.go b/tests/integration/query/one_to_many/with_sum_limit_offset_test.go index c907ade5dd..ea89759d72 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_offset_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_offset_test.go @@ -27,37 +27,37 @@ func TestQueryOneToManyWithSumWithLimitAndOffset(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -66,14 +66,14 @@ func TestQueryOneToManyWithSumWithLimitAndOffset(t *testing.T) { }, }, Results: []map[string]any{ - { - "name": "John Grisham", - "_sum": 9.4, - }, { "name": "Cornelia Funke", "_sum": float64(0), }, + { + "name": "John Grisham", + "_sum": 9.4, + }, }, } diff --git a/tests/integration/query/one_to_many/with_sum_limit_test.go b/tests/integration/query/one_to_many/with_sum_limit_test.go index e049e77226..f7fe551567 100644 --- a/tests/integration/query/one_to_many/with_sum_limit_test.go +++ b/tests/integration/query/one_to_many/with_sum_limit_test.go @@ -27,37 +27,37 @@ func TestQueryOneToManyWithSumWithLimit(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "The Associate", "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, `{ "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + "author_id": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace" }`, }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 + // bae-72e8c691-9f20-55e7-9228-8af1cf54cace `{ "name": "Cornelia Funke", "age": 62, @@ -66,15 +66,15 @@ func TestQueryOneToManyWithSumWithLimit(t *testing.T) { }, }, Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": 4.8, + }, { "name": "John Grisham", // .00...1 is float math thing "_sum": 9.100000000000001, }, - { - "name": "Cornelia Funke", - "_sum": 4.8, - }, }, } diff --git a/tests/integration/query/one_to_many/with_typename_test.go b/tests/integration/query/one_to_many/with_typename_test.go index b5dca894e0..db318066f0 100644 --- a/tests/integration/query/one_to_many/with_typename_test.go +++ b/tests/integration/query/one_to_many/with_typename_test.go @@ -31,15 +31,15 @@ func TestQueryOneToManyWithTypeName(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + "author_id": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b" }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b `{ "name": "John Grisham", "age": 65, diff --git a/tests/integration/query/one_to_many_multiple/utils.go b/tests/integration/query/one_to_many_multiple/utils.go deleted file mode 100644 index fe7584a980..0000000000 --- a/tests/integration/query/one_to_many_multiple/utils.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2022 Democratized Data Foundation -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package one_to_many_multiple - -import ( - "testing" - - testUtils "github.com/sourcenetwork/defradb/tests/integration" -) - -var bookAuthorGQLSchema = (` - type Article { - name: String - author: Author - rating: Int - } - - type Book { - name: String - author: Author - score: Int - } - - type Author { - name: String - age: Int - verified: Boolean - books: [Book] - articles: [Article] - } -`) - -func executeTestCase(t *testing.T, test testUtils.RequestTestCase) { - testUtils.ExecuteRequestTestCase(t, bookAuthorGQLSchema, []string{"Article", "Book", "Author"}, test) -} diff --git a/tests/integration/query/one_to_many_multiple/with_average_filter_test.go b/tests/integration/query/one_to_many_multiple/with_average_filter_test.go index b55390efe1..9685790830 100644 --- a/tests/integration/query/one_to_many_multiple/with_average_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_average_filter_test.go @@ -17,165 +17,247 @@ import ( ) func TestQueryOneToManyMultipleWithAverageOnMultipleJoinsWithAndWithoutFilter(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with averages with and without filters", - Request: `query { - Author { - name - _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_avg": float64(3), + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), + testUtils.Request{ + Request: `query { + Author { + name + _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(3), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyMultipleWithAverageOnMultipleJoinsWithFilters(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with averages with filters", - Request: `query { - Author { - name - _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_avg": float64(0), + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), + testUtils.Request{ + Request: `query { + Author { + name + _avg(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(0), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_average_test.go b/tests/integration/query/one_to_many_multiple/with_average_test.go index 615782ab4a..a2af6b6a67 100644 --- a/tests/integration/query/one_to_many_multiple/with_average_test.go +++ b/tests/integration/query/one_to_many_multiple/with_average_test.go @@ -17,83 +17,124 @@ import ( ) func TestQueryOneToManyMultipleWithAverageOnMultipleJoins(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with average", - Request: `query { - Author { - name - _avg(books: {field: score}, articles: {field: rating}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_avg": float64(2.25), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_avg": float64(2.3333333333333335), + testUtils.Request{ + Request: `query { + Author { + name + _avg(books: {field: score}, articles: {field: rating}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_avg": float64(2.3333333333333335), + }, + { + "name": "John Grisham", + "_avg": float64(2.25), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_count_filter_test.go b/tests/integration/query/one_to_many_multiple/with_count_filter_test.go index ea97e7c17d..9cb9409d41 100644 --- a/tests/integration/query/one_to_many_multiple/with_count_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_count_filter_test.go @@ -17,165 +17,247 @@ import ( ) func TestQueryOneToManyMultipleWithCountOnMultipleJoinsWithAndWithoutFilter(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with counts with and without filters", - Request: `query { - Author { - name - _count(books: {filter: {score: {_gt: 3}}}, articles: {}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 1, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, }, - { - "name": "Cornelia Funke", - "_count": 3, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _count(books: {filter: {score: {_gt: 3}}}, articles: {}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 1, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyMultipleWithCountOnMultipleJoinsWithFilters(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with counts with filters", - Request: `query { - Author { - name - _count(books: {filter: {score: {_gt: 3}}}, articles: {filter: {rating: {_lt: 3}}}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 0, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, }, - { - "name": "Cornelia Funke", - "_count": 3, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _count(books: {filter: {score: {_gt: 3}}}, articles: {filter: {rating: {_lt: 3}}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 0, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_count_test.go b/tests/integration/query/one_to_many_multiple/with_count_test.go index 1956f95abd..f6155ffc16 100644 --- a/tests/integration/query/one_to_many_multiple/with_count_test.go +++ b/tests/integration/query/one_to_many_multiple/with_count_test.go @@ -17,150 +17,242 @@ import ( ) func TestQueryOneToManyMultipleWithCount(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with count", - Request: `query { - Author { - name - numberOfBooks: _count(books: {}) - numberOfArticles: _count(articles: {}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "numberOfBooks": 2, - "numberOfArticles": 1, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, }, - { - "name": "Cornelia Funke", - "numberOfBooks": 1, - "numberOfArticles": 2, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + numberOfBooks: _count(books: {}) + numberOfArticles: _count(articles: {}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "numberOfBooks": 1, + "numberOfArticles": 2, + }, + { + "name": "John Grisham", + "numberOfBooks": 2, + "numberOfArticles": 1, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyMultipleWithCountOnMultipleJoins(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with count", - Request: `query { - Author { - name - _count(books: {}, articles: {}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_count": 4, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, }, - { - "name": "Cornelia Funke", - "_count": 3, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + _count(books: {}, articles: {}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_count": 3, + }, + { + "name": "John Grisham", + "_count": 4, + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go b/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go index 26a15729ea..a30f2f78a1 100644 --- a/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_multiple_filter_test.go @@ -17,77 +17,118 @@ import ( ) func TestQueryOneToManyMultipleWithMultipleManyFilters(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from one side with multiple many fitlers", - Request: `query { - Author(filter: {name: {_eq: "John Grisham"}, books: {score: {_eq: 1}}, articles: {rating: {_eq: 3}}}) { - name - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, + }, + testUtils.Request{ + Request: `query { + Author(filter: {name: {_eq: "John Grisham"}, books: {score: {_eq: 1}}, articles: {rating: {_eq: 3}}}) { + name + } + }`, + Results: []map[string]any{ + { + "name": "John Grisham", + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go b/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go index a14cb59926..f5f278a1f2 100644 --- a/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go +++ b/tests/integration/query/one_to_many_multiple/with_sum_filter_test.go @@ -17,165 +17,247 @@ import ( ) func TestQueryOneToManyMultipleWithSumOnMultipleJoinsWithAndWithoutFilter(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sums with and without filters", - Request: `query { - Author { - name - _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_sum": int64(3), + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_sum": int64(7), + testUtils.Request{ + Request: `query { + Author { + name + _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(3), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToManyMultipleWithSumOnMultipleJoinsWithFilters(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sums with filters", - Request: `query { - Author { - name - _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, - }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, - }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_sum": int64(0), + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_sum": int64(7), + testUtils.Request{ + Request: `query { + Author { + name + _sum(books: {field: score, filter: {score: {_gt: 3}}}, articles: {field: rating, filter: {rating: {_lt: 3}}}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(0), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_multiple/with_sum_test.go b/tests/integration/query/one_to_many_multiple/with_sum_test.go index 81f96e93c4..a1f9176722 100644 --- a/tests/integration/query/one_to_many_multiple/with_sum_test.go +++ b/tests/integration/query/one_to_many_multiple/with_sum_test.go @@ -17,83 +17,124 @@ import ( ) func TestQueryOneToManyMultipleWithSumOnMultipleJoins(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-many relation query from many side with sum", - Request: `query { - Author { - name - _sum(books: {field: score}, articles: {field: rating}) - } - }`, - Docs: map[int][]string{ - //articles - 0: { - `{ - "name": "After Guantánamo, Another Injustice", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "rating": 3 - }`, - `{ - "name": "To my dear readers", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 2 - }`, - `{ - "name": "Twinklestar's Favourite Xmas Cookie", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "rating": 1 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Article { + name: String + author: Author + rating: Int + } + + type Book { + name: String + author: Author + score: Int + } + + type Author { + name: String + age: Int + verified: Boolean + books: [Book] + articles: [Article] + } + `, }, - //books - 1: { - `{ - "name": "Painted House", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 1 - }`, - `{ - "name": "A Time for Mercy", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 2 - }`, - `{ - "name": "Sooley", - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "score": 3 - }`, - `{ - "name": "Theif Lord", - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "score": 4 - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + }, }, - //authors - 2: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "_sum": int64(9), + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "After Guantánamo, Another Injustice", + "author_id": testUtils.NewDocIndex(2, 0), + "rating": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "To my dear readers", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Twinklestar's Favourite Xmas Cookie", + "author_id": testUtils.NewDocIndex(2, 1), + "rating": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 1, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 2, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "author_id": testUtils.NewDocIndex(2, 0), + "score": 3, + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "author_id": testUtils.NewDocIndex(2, 1), + "score": 4, + }, }, - { - "name": "Cornelia Funke", - "_sum": int64(7), + testUtils.Request{ + Request: `query { + Author { + name + _sum(books: {field: score}, articles: {field: rating}) + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "_sum": int64(7), + }, + { + "name": "John Grisham", + "_sum": int64(9), + }, + }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_to_many/joins_test.go b/tests/integration/query/one_to_many_to_many/joins_test.go index 2e040b05a7..d4d4da2ca5 100644 --- a/tests/integration/query/one_to_many_to_many/joins_test.go +++ b/tests/integration/query/one_to_many_to_many/joins_test.go @@ -17,205 +17,248 @@ import ( ) func TestOneToManyToManyJoinsAreLinkedProperly(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "1-N-M Query to ensure joins are linked properly.", - Request: `query { - Author { - _docID - name - book { - _docID - name - publisher { - _docID - name + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Author { + name: String + age: Int + verified: Boolean + book: [Book] } - } - } - }`, - Docs: map[int][]string{ - // Authors - 0: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3, Has written 5 books - `{ + type Book { + name: String + rating: Float + author: Author + publisher: [Publisher] + } + + type Publisher { + name: String + address: String + yearOpened: Int + book: Book + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 0, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04, Has written 1 Book - `{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, - // Has written no Book - `{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + Doc: `{ "name": "Not a Writer", "age": 6, "verified": false }`, }, - - // Books - 1: { - // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - // "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", Has 1 Publisher - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - // "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", Has no Publisher. - `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - // "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", Has 1 Publisher - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - // "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a", Has 1 Publisher - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - // "bae-7ba73251-c935-5f44-ac04-d2061149cc14", Has 2 Publishers - `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, - - // Publishers - 2: { - `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, - `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", + "book_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", "yearOpened": 2020, - "book_id": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf" - }`, - `{ - "name": "Only Publisher of Painted House", - "address": "600 Madison Ave., New York, New York", + "book_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Only Publisher of Painted House", + "address": "600 Madison Ave., New York, New York", "yearOpened": 1995, - "book_id": "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" - }`, - `{ - "name": "Only Publisher of A Time for Mercy", - "address": "123 Andrew Street, Flin Flon, Manitoba", + "book_id": testUtils.NewDocIndex(1, 3), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Only Publisher of A Time for Mercy", + "address": "123 Andrew Street, Flin Flon, Manitoba", "yearOpened": 2013, - "book_id": "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a" - }`, - `{ - "name": "First of Two Publishers of Sooley", - "address": "11 Sooley Ave., Waterloo, Ontario", + "book_id": testUtils.NewDocIndex(1, 4), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "First of Two Publishers of Sooley", + "address": "11 Sooley Ave., Waterloo, Ontario", "yearOpened": 1999, - "book_id": "bae-7ba73251-c935-5f44-ac04-d2061149cc14" - }`, - `{ - "name": "Second of Two Publishers of Sooley", - "address": "22 Sooley Ave., Waterloo, Ontario", + "book_id": testUtils.NewDocIndex(1, 5), + }, + }, + testUtils.CreateDoc{ + CollectionID: 2, + DocMap: map[string]any{ + "name": "Second of Two Publishers of Sooley", + "address": "22 Sooley Ave., Waterloo, Ontario", "yearOpened": 2000, - "book_id": "bae-7ba73251-c935-5f44-ac04-d2061149cc14" - }`, + "book_id": testUtils.NewDocIndex(1, 5), + }, }, - }, - - Results: []map[string]any{ - { - "name": "John Grisham", - "_docID": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "book": []map[string]any{ - + testUtils.Request{ + Request: `query { + Author { + _docID + name + book { + _docID + name + publisher { + _docID + name + } + } + } + }`, + Results: []map[string]any{ { - "_docID": "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", - "name": "The Associate", - "publisher": []map[string]any{}, + "_docID": "bae-4819f8a1-b519-5b46-ae39-4fdda8558e4f", + "book": []map[string]any{}, + "name": "Not a Writer", }, - { - "_docID": "bae-7ba73251-c935-5f44-ac04-d2061149cc14", - "name": "Sooley", - "publisher": []map[string]any{ + "name": "Cornelia Funke", + "_docID": "bae-72e8c691-9f20-55e7-9228-8af1cf54cace", + "book": []map[string]any{ { - "_docID": "bae-cecb7841-fb4c-5403-a6d7-3654694dd073", - "name": "First of Two Publishers of Sooley", - }, - { - "_docID": "bae-d7e35ac3-dcf3-5537-91dd-3d27e378ba5d", - "name": "Second of Two Publishers of Sooley", + "_docID": "bae-4dbc2bbc-0652-5412-8063-486499f1c341", + "name": "The Rooster Bar", + "publisher": []map[string]any{ + { + "_docID": "bae-8a8cbab7-65db-5955-b618-b82f44761cee", + "name": "Only Publisher of The Rooster Bar", + }, + }, }, }, }, - { - "_docID": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", - "name": "Theif Lord", - "publisher": []map[string]any{ + "name": "John Grisham", + "_docID": "bae-e1ea288f-09fa-55fa-b0b5-0ac8941ea35b", + "book": []map[string]any{ { - "_docID": "bae-1a3ca715-3f3c-5934-9133-d7b489d57f88", - "name": "Only Publisher of Theif Lord", + "_docID": "bae-13164fd9-60fd-5c32-9cb5-8bff3ef8ea53", + "name": "Theif Lord", + "publisher": []map[string]any{ + { + "_docID": "bae-0107f5cc-c25a-5295-8439-2b08a286af83", + "name": "Only Publisher of Theif Lord", + }, + }, }, - }, - }, - - { - "_docID": "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", - "name": "Painted House", - "publisher": []map[string]any{ { - "_docID": "bae-6412f5ff-a69a-5472-8647-18bf2b247697", - "name": "Only Publisher of Painted House", + "_docID": "bae-1ccf3043-d760-543e-be1b-6691fa6aa7a8", + "name": "The Associate", + "publisher": []map[string]any{}, }, - }, - }, - { - "_docID": "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a", - "name": "A Time for Mercy", - "publisher": []map[string]any{ { - "_docID": "bae-2f83fa75-241f-517d-9b47-3715feee43c1", - "name": "Only Publisher of A Time for Mercy", + "_docID": "bae-5366ba09-54e8-5381-8169-a770aa9282ae", + "name": "Painted House", + "publisher": []map[string]any{ + { + "_docID": "bae-35f1e55a-c51b-53d7-9b28-9beb904a1343", + "name": "Only Publisher of Painted House", + }, + }, + }, + { + "_docID": "bae-96c9de0f-2903-5589-9604-b42882afde8c", + "name": "A Time for Mercy", + "publisher": []map[string]any{ + { + "_docID": "bae-37451579-7e50-541d-8a3c-849b290ea416", + "name": "Only Publisher of A Time for Mercy", + }, + }, }, - }, - }, - }, - }, - - { - "_docID": "bae-7ba214a4-5ac8-5878-b221-dae6c285ef41", - "book": []map[string]any{}, - "name": "Not a Writer", - }, - - { - "name": "Cornelia Funke", - "_docID": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "book": []map[string]any{ - { - "_docID": "bae-080d7580-a791-541e-90bd-49bf69f858e1", - "name": "The Rooster Bar", - "publisher": []map[string]any{ { - "_docID": "bae-a5836991-96a3-5147-83be-3374a8b62e6c", - "name": "Only Publisher of The Rooster Bar", + "_docID": "bae-f52abfc3-9026-5713-9622-2d3458a386e0", + "name": "Sooley", + "publisher": []map[string]any{ + { + "_docID": "bae-c46b7771-843e-51ac-92be-d145aa2cfc07", + "name": "Second of Two Publishers of Sooley", + }, + { + "_docID": "bae-fc233f9c-f117-59de-be2b-60e4f6f0a898", + "name": "First of Two Publishers of Sooley", + }, + }, }, }, }, @@ -224,5 +267,5 @@ func TestOneToManyToManyJoinsAreLinkedProperly(t *testing.T) { }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_many_to_many/utils.go b/tests/integration/query/one_to_many_to_many/utils.go deleted file mode 100644 index 0dbc191c96..0000000000 --- a/tests/integration/query/one_to_many_to_many/utils.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Democratized Data Foundation -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package one_to_many_to_many - -import ( - "testing" - - testUtils "github.com/sourcenetwork/defradb/tests/integration" -) - -var gqlSchemaOneToManyToMany = (` - - type Author { - name: String - age: Int - verified: Boolean - book: [Book] - } - - type Book { - name: String - rating: Float - author: Author - publisher: [Publisher] - } - - type Publisher { - name: String - address: String - yearOpened: Int - book: Book - } - -`) - -func executeTestCase( - t *testing.T, - test testUtils.RequestTestCase, -) { - testUtils.ExecuteRequestTestCase( - t, - gqlSchemaOneToManyToMany, - []string{ - "Author", - "Book", - "Publisher", - }, - test, - ) -} diff --git a/tests/integration/query/one_to_many_to_one/fixture.go b/tests/integration/query/one_to_many_to_one/fixture.go index a078c630b2..ac66aa098d 100644 --- a/tests/integration/query/one_to_many_to_one/fixture.go +++ b/tests/integration/query/one_to_many_to_one/fixture.go @@ -47,7 +47,7 @@ func createDocsWith6BooksAnd5Publishers() []testUtils.CreateDoc { // Authors { CollectionID: 0, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3, Has written 5 books + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84, Has written 5 books Doc: `{ "name": "John Grisham", "age": 65, @@ -76,102 +76,102 @@ func createDocsWith6BooksAnd5Publishers() []testUtils.CreateDoc { { CollectionID: 1, // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - Doc: `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, { CollectionID: 1, - // "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", Has 1 Publisher - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-7697f14d-7b32-5884-8677-344e183c14bf", Has 1 Publisher + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, { CollectionID: 1, - // "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", Has no Publisher. - Doc: `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-374998e0-e84d-5f6b-9e87-5edaaa2d9c7d", Has no Publisher. + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, { CollectionID: 1, - // "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", Has 1 Publisher - Doc: `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-aef1d940-5ac1-5924-a87f-63ac40758b22", Has 1 Publisher + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, { CollectionID: 1, - // "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a", Has 1 Publisher - Doc: `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-1d0dcbed-300a-567a-9b48-c23cd026d165", Has 1 Publisher + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, { CollectionID: 1, - // "bae-7ba73251-c935-5f44-ac04-d2061149cc14", Has 1 Publisher - Doc: `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-ee6b8339-8a9e-58a9-9a0d-dbd8d44fa149", Has 1 Publisher + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, // Publishers { CollectionID: 2, - Doc: `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", - "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", + "yearOpened": 2022, + "book_id": testUtils.NewDocIndex(1, 0), + }, }, { CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", - "yearOpened": 2020, - "book_id": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf" - }`, + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", + "yearOpened": 2020, + "book_id": testUtils.NewDocIndex(1, 1), + }, }, { CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Painted House", - "address": "600 Madison Ave., New York, New York", - "yearOpened": 1995, - "book_id": "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" - }`, + DocMap: map[string]any{ + "name": "Only Publisher of Painted House", + "address": "600 Madison Ave., New York, New York", + "yearOpened": 1995, + "book_id": testUtils.NewDocIndex(1, 3), + }, }, { CollectionID: 2, - Doc: `{ - "name": "Only Publisher of A Time for Mercy", - "address": "123 Andrew Street, Flin Flon, Manitoba", - "yearOpened": 2013, - "book_id": "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a" - }`, + DocMap: map[string]any{ + "name": "Only Publisher of A Time for Mercy", + "address": "123 Andrew Street, Flin Flon, Manitoba", + "yearOpened": 2013, + "book_id": testUtils.NewDocIndex(1, 4), + }, }, { CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Sooley", - "address": "11 Sooley Ave., Waterloo, Ontario", - "yearOpened": 1999, - "book_id": "bae-7ba73251-c935-5f44-ac04-d2061149cc14" - }`, + DocMap: map[string]any{ + "name": "Only Publisher of Sooley", + "address": "11 Sooley Ave., Waterloo, Ontario", + "yearOpened": 1999, + "book_id": testUtils.NewDocIndex(1, 5), + }, }, } } diff --git a/tests/integration/query/one_to_many_to_one/joins_test.go b/tests/integration/query/one_to_many_to_one/joins_test.go index dbb6dad8da..9cd6432112 100644 --- a/tests/integration/query/one_to_many_to_one/joins_test.go +++ b/tests/integration/query/one_to_many_to_one/joins_test.go @@ -24,7 +24,7 @@ func TestOneToManyToOneJoinsAreLinkedProperly(t *testing.T) { // Authors testUtils.CreateDoc{ CollectionID: 0, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3, Has written 5 books + // Has written 5 books Doc: `{ "name": "John Grisham", "age": 65, @@ -33,7 +33,7 @@ func TestOneToManyToOneJoinsAreLinkedProperly(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04, Has written 1 Book + // Has written 1 Book Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -52,103 +52,103 @@ func TestOneToManyToOneJoinsAreLinkedProperly(t *testing.T) { // Books testUtils.CreateDoc{ CollectionID: 1, - // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - Doc: `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", Has 1 Publisher - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", Has no Publisher. - Doc: `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has no Publisher. + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", Has 1 Publisher - Doc: `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a", Has 1 Publisher - Doc: `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-7ba73251-c935-5f44-ac04-d2061149cc14", Has 1 Publisher - Doc: `{ - "name": "Sooley", - "rating": 3.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "Sooley", + "rating": 3.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, // Publishers testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, + "book_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", "yearOpened": 2020, - "book_id": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf" - }`, + "book_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Painted House", - "address": "600 Madison Ave., New York, New York", + DocMap: map[string]any{ + "name": "Only Publisher of Painted House", + "address": "600 Madison Ave., New York, New York", "yearOpened": 1995, - "book_id": "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d" - }`, + "book_id": testUtils.NewDocIndex(1, 3), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of A Time for Mercy", - "address": "123 Andrew Street, Flin Flon, Manitoba", + DocMap: map[string]any{ + "name": "Only Publisher of A Time for Mercy", + "address": "123 Andrew Street, Flin Flon, Manitoba", "yearOpened": 2013, - "book_id": "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a" - }`, + "book_id": testUtils.NewDocIndex(1, 4), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Sooley", - "address": "11 Sooley Ave., Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of Sooley", + "address": "11 Sooley Ave., Waterloo, Ontario", "yearOpened": 1999, - "book_id": "bae-7ba73251-c935-5f44-ac04-d2061149cc14" - }`, + "book_id": testUtils.NewDocIndex(1, 5), + }, }, testUtils.Request{ Request: `query { @@ -166,63 +166,63 @@ func TestOneToManyToOneJoinsAreLinkedProperly(t *testing.T) { } }`, Results: []map[string]any{ + { + "_docID": "bae-489b4e01-4764-56f6-913f-b3c92dffcaa3", + "book": []map[string]any{}, + "name": "Not a Writer", + }, { "name": "John Grisham", - "_docID": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", + "_docID": "bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84", "book": []map[string]any{ { - "_docID": "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", - "name": "The Associate", - "publisher": nil, - }, - { - "_docID": "bae-7ba73251-c935-5f44-ac04-d2061149cc14", - "name": "Sooley", + "_docID": "bae-1d0dcbed-300a-567a-9b48-c23cd026d165", + "name": "A Time for Mercy", "publisher": map[string]any{ - "_docID": "bae-cd2a319a-e013-559e-aad9-282b48fd3f72", - "name": "Only Publisher of Sooley", + "_docID": "bae-2bad7de3-0f1a-56c0-b499-a552debef4b8", + "name": "Only Publisher of A Time for Mercy", }, }, { - "_docID": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", + "_docID": "bae-374998e0-e84d-5f6b-9e87-5edaaa2d9c7d", + "name": "The Associate", + "publisher": nil, + }, + { + "_docID": "bae-7697f14d-7b32-5884-8677-344e183c14bf", "name": "Theif Lord", "publisher": map[string]any{ - "_docID": "bae-1a3ca715-3f3c-5934-9133-d7b489d57f88", + "_docID": "bae-d43823c0-0bb6-58a9-a098-1826dffa4e4a", "name": "Only Publisher of Theif Lord", }, }, { - "_docID": "bae-b9b83269-1f28-5c3b-ae75-3fb4c00d559d", + "_docID": "bae-aef1d940-5ac1-5924-a87f-63ac40758b22", "name": "Painted House", "publisher": map[string]any{ - "_docID": "bae-6412f5ff-a69a-5472-8647-18bf2b247697", + "_docID": "bae-a104397b-7804-5cd0-93e5-c3986b4e5e71", "name": "Only Publisher of Painted House", }, }, { - "_docID": "bae-c674e3b0-ebb6-5b89-bfa3-d1128288d21a", - "name": "A Time for Mercy", + "_docID": "bae-ee6b8339-8a9e-58a9-9a0d-dbd8d44fa149", + "name": "Sooley", "publisher": map[string]any{ - "_docID": "bae-2f83fa75-241f-517d-9b47-3715feee43c1", - "name": "Only Publisher of A Time for Mercy", + "_docID": "bae-efeca601-cce1-5289-b392-85fa5b7bc0f7", + "name": "Only Publisher of Sooley", }, }, }, }, - { - "_docID": "bae-7ba214a4-5ac8-5878-b221-dae6c285ef41", - "book": []map[string]any{}, - "name": "Not a Writer", - }, { "name": "Cornelia Funke", - "_docID": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", + "_docID": "bae-fb2a1852-3951-5ce9-a3bf-6825202f201b", "book": []map[string]any{ { - "_docID": "bae-080d7580-a791-541e-90bd-49bf69f858e1", + "_docID": "bae-1867d7cb-01b3-572f-a993-1c3f22f46526", "name": "The Rooster Bar", "publisher": map[string]any{ - "_docID": "bae-a5836991-96a3-5147-83be-3374a8b62e6c", + "_docID": "bae-09af7e39-8596-584f-8825-cb430c4156b3", "name": "Only Publisher of The Rooster Bar", }, }, diff --git a/tests/integration/query/one_to_many_to_one/simple_test.go b/tests/integration/query/one_to_many_to_one/simple_test.go index 03bb0b781f..d1551300da 100644 --- a/tests/integration/query/one_to_many_to_one/simple_test.go +++ b/tests/integration/query/one_to_many_to_one/simple_test.go @@ -24,7 +24,7 @@ func TestQueryOneToOneRelations(t *testing.T) { // Authors testUtils.CreateDoc{ CollectionID: 0, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3, Has written 5 books + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84, Has written 5 books Doc: `{ "name": "John Grisham", "age": 65, @@ -53,50 +53,49 @@ func TestQueryOneToOneRelations(t *testing.T) { testUtils.CreateDoc{ CollectionID: 1, // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - Doc: `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", Has 1 Publisher - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-7697f14d-7b32-5884-8677-344e183c14bf", Has 1 Publisher + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", Has no Publisher. - Doc: `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // "bae-374998e0-e84d-5f6b-9e87-5edaaa2d9c7d", Has no Publisher. + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, // Publishers testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, + "book_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", "yearOpened": 2020, - "book_id": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf" - }`, + "book_id": testUtils.NewDocIndex(1, 1), + }, }, - testUtils.Request{ Request: `query { Book { diff --git a/tests/integration/query/one_to_many_to_one/with_filter_test.go b/tests/integration/query/one_to_many_to_one/with_filter_test.go index 65c402dfa2..bd56f7bc39 100644 --- a/tests/integration/query/one_to_many_to_one/with_filter_test.go +++ b/tests/integration/query/one_to_many_to_one/with_filter_test.go @@ -24,7 +24,6 @@ func TestQueryComplexWithDeepFilterOnRenderedChildren(t *testing.T) { // Authors testUtils.CreateDoc{ CollectionID: 0, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3, Has written 5 books Doc: `{ "name": "John Grisham", "age": 65, @@ -33,7 +32,7 @@ func TestQueryComplexWithDeepFilterOnRenderedChildren(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04, Has written 1 Book + // Has written 1 Book Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -52,49 +51,49 @@ func TestQueryComplexWithDeepFilterOnRenderedChildren(t *testing.T) { // Books testUtils.CreateDoc{ CollectionID: 1, - // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - Doc: `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf", Has 1 Publisher - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-4fb9e3e9-d1d3-5404-bf15-10e4c995d9ca", Has no Publisher. - Doc: `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + // Has no Publisher. + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, // Publishers testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, + "book_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", "yearOpened": 2020, - "book_id": "bae-b8091c4f-7594-5d7a-98e8-272aadcedfdf" - }`, + "book_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -141,6 +140,11 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeOfBothDescAndAsc(t *testing.T) } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "s2": 0.0, + }, { "name": "John Grisham", // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). @@ -148,11 +152,6 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeOfBothDescAndAsc(t *testing.T) // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). "s2": 4.8, }, - { - "name": "Not a Writer", - "s1": 0.0, - "s2": 0.0, - }, { "name": "Cornelia Funke", "s1": 0.0, @@ -183,6 +182,11 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeAndDeepOrderBySubtypeOppositeDi } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "books2020": []map[string]any{}, + }, { "name": "John Grisham", "s1": 4.5, @@ -192,11 +196,6 @@ func TestOneToManyToOneWithSumOfDeepFilterSubTypeAndDeepOrderBySubtypeOppositeDi }, }, }, - { - "name": "Not a Writer", - "s1": 0.0, - "books2020": []map[string]any{}, - }, { "name": "Cornelia Funke", "s1": 0.0, @@ -236,15 +235,15 @@ func TestOneToManyToOneWithTwoLevelDeepFilter(t *testing.T) { { "book": []map[string]any{ { - "name": "The Associate", - "publisher": nil, - }, - { - "name": "Sooley", + "name": "A Time for Mercy", "publisher": map[string]any{ - "yearOpened": int64(1999), + "yearOpened": int64(2013), }, }, + { + "name": "The Associate", + "publisher": nil, + }, { "name": "Theif Lord", "publisher": map[string]any{ @@ -258,9 +257,9 @@ func TestOneToManyToOneWithTwoLevelDeepFilter(t *testing.T) { }, }, { - "name": "A Time for Mercy", + "name": "Sooley", "publisher": map[string]any{ - "yearOpened": int64(2013), + "yearOpened": int64(1999), }, }, }, @@ -293,7 +292,6 @@ func TestOneToManyToOneWithCompoundOperatorInFilterAndRelation(t *testing.T) { createDocsWith6BooksAnd5Publishers(), testUtils.CreateDoc{ CollectionID: 0, - // bae-61d279c1-eab9-56ec-8654-dce0324ebfda Doc: `{ "name": "John Tolkien", "age": 70, @@ -302,21 +300,20 @@ func TestOneToManyToOneWithCompoundOperatorInFilterAndRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-2c116b72-21f1-5c87-9148-f69f0c0c087e - Doc: `{ - "name": "The Lord of the Rings", - "rating": 5.0, - "author_id": "bae-61d279c1-eab9-56ec-8654-dce0324ebfda" - }`, + DocMap: map[string]any{ + "name": "The Lord of the Rings", + "rating": 5.0, + "author_id": testUtils.NewDocIndex(0, 3), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Allen & Unwin", - "address": "1 Allen Ave., Sydney, Australia", + DocMap: map[string]any{ + "name": "Allen & Unwin", + "address": "1 Allen Ave., Sydney, Australia", "yearOpened": 1954, - "book_id": "bae-2c116b72-21f1-5c87-9148-f69f0c0c087e" - }`, + "book_id": testUtils.NewDocIndex(1, 6), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_many_to_one/with_order_limit_test.go b/tests/integration/query/one_to_many_to_one/with_order_limit_test.go index fecfdc980d..1ec7c0296e 100644 --- a/tests/integration/query/one_to_many_to_one/with_order_limit_test.go +++ b/tests/integration/query/one_to_many_to_one/with_order_limit_test.go @@ -35,6 +35,11 @@ func TestOneToManyToOneDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) { } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "NewestPublishersBook": []map[string]any{}, + "OldestPublishersBook": []map[string]any{}, + }, { "name": "John Grisham", "NewestPublishersBook": []map[string]any{ @@ -48,11 +53,6 @@ func TestOneToManyToOneDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) { }, }, }, - { - "name": "Not a Writer", - "NewestPublishersBook": []map[string]any{}, - "OldestPublishersBook": []map[string]any{}, - }, { "name": "Cornelia Funke", "NewestPublishersBook": []map[string]any{ diff --git a/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go b/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go index bcb344c1e9..28379253b4 100644 --- a/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go +++ b/tests/integration/query/one_to_many_to_one/with_sum_order_limit_test.go @@ -33,6 +33,11 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeDescDirec } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "NewestPublishersBook": []map[string]any{}, + }, { "name": "John Grisham", "s1": 4.8 + 4.5, // Because in descending order years for John are [2020, 2013]. @@ -45,11 +50,6 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeDescDirec }, }, }, - { - "name": "Not a Writer", - "s1": 0.0, - "NewestPublishersBook": []map[string]any{}, - }, { "name": "Cornelia Funke", "s1": 4.0, @@ -83,6 +83,11 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeAscDirect } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "NewestPublishersBook": []map[string]any{}, + }, { "name": "John Grisham", // Because in ascending order years for John are: @@ -97,11 +102,6 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeAscDirect }, }, }, - { - "name": "Not a Writer", - "s1": 0.0, - "NewestPublishersBook": []map[string]any{}, - }, { "name": "Cornelia Funke", "s1": 4.0, @@ -134,6 +134,11 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "s2": 0.0, + }, { "name": "John Grisham", // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). @@ -141,11 +146,6 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeOfBothDescAndAsc(t *testing.T) // 'The Associate' as it has no Publisher (4.2 rating), then 'Painted House' 1995 (4.9 rating). "s2": float64(4.2) + float64(4.9), }, - { - "name": "Not a Writer", - "s1": 0.0, - "s2": 0.0, - }, { "name": "Cornelia Funke", "s1": 4.0, @@ -176,6 +176,11 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeOppositeD } }`, Results: []map[string]any{ + { + "name": "Not a Writer", + "s1": 0.0, + "OldestPublishersBook": []map[string]any{}, + }, { "name": "John Grisham", // 'Theif Lord' (4.8 rating) 2020, then 'A Time for Mercy' 2013 (4.5 rating). @@ -189,11 +194,6 @@ func TestOneToManyToOneWithSumOfDeepOrderBySubTypeAndDeepOrderBySubtypeOppositeD }, }, }, - { - "name": "Not a Writer", - "s1": 0.0, - "OldestPublishersBook": []map[string]any{}, - }, { "name": "Cornelia Funke", "s1": 4.0, diff --git a/tests/integration/query/one_to_many_to_one/with_sum_test.go b/tests/integration/query/one_to_many_to_one/with_sum_test.go index b1db62f07a..192784144e 100644 --- a/tests/integration/query/one_to_many_to_one/with_sum_test.go +++ b/tests/integration/query/one_to_many_to_one/with_sum_test.go @@ -24,7 +24,6 @@ func TestQueryWithSumOnInlineAndSumOnOneToManyField(t *testing.T) { // Authors testUtils.CreateDoc{ CollectionID: 0, - // bae-0c100ad0-1511-5f37-984d-66fa8534b06f, Has written 5 books Doc: `{ "name": "John Grisham", "age": 65, @@ -34,7 +33,7 @@ func TestQueryWithSumOnInlineAndSumOnOneToManyField(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04, Has written 1 Book + // Has written 1 Book Doc: `{ "name": "Cornelia Funke", "age": 62, @@ -44,49 +43,49 @@ func TestQueryWithSumOnInlineAndSumOnOneToManyField(t *testing.T) { // Books testUtils.CreateDoc{ CollectionID: 1, - // "bae-080d7580-a791-541e-90bd-49bf69f858e1", Has 1 Publisher - Doc: `{ - "name": "The Rooster Bar", - "rating": 4, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "The Rooster Bar", + "rating": 4, + "author_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-afdd1769-b056-5bb1-b743-116a347b4b87", Has 1 Publisher - Doc: `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-0c100ad0-1511-5f37-984d-66fa8534b06f" - }`, + // Has 1 Publisher + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-fbba03cf-c77c-5850-a6a4-0d9992d489e1", Has no Publisher. - Doc: `{ - "name": "The Associate", - "rating": 4.2, - "author_id": "bae-0c100ad0-1511-5f37-984d-66fa8534b06f" - }`, + // Has no Publisher. + DocMap: map[string]any{ + "name": "The Associate", + "rating": 4.2, + "author_id": testUtils.NewDocIndex(0, 0), + }, }, // Publishers testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of The Rooster Bar", - "address": "1 Rooster Ave., Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of The Rooster Bar", + "address": "1 Rooster Ave., Waterloo, Ontario", "yearOpened": 2022, - "book_id": "bae-080d7580-a791-541e-90bd-49bf69f858e1" - }`, + "book_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Only Publisher of Theif Lord", - "address": "1 Theif Lord, Waterloo, Ontario", + DocMap: map[string]any{ + "name": "Only Publisher of Theif Lord", + "address": "1 Theif Lord, Waterloo, Ontario", "yearOpened": 2020, - "book_id": "bae-afdd1769-b056-5bb1-b743-116a347b4b87" - }`, + "book_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_one/simple_test.go b/tests/integration/query/one_to_one/simple_test.go index b5a1da594c..f0eb5f1f4e 100644 --- a/tests/integration/query/one_to_one/simple_test.go +++ b/tests/integration/query/one_to_one/simple_test.go @@ -32,19 +32,19 @@ func TestQueryOneToOne(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, }, @@ -73,19 +73,19 @@ func TestQueryOneToOne(t *testing.T) { }`, Docs: map[int][]string{ //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + 0: { // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, }, //authors - 1: { // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + 1: { // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, }, @@ -108,119 +108,161 @@ func TestQueryOneToOne(t *testing.T) { } func TestQueryOneToOneWithMultipleRecords(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-one relation primary direction, multiple records", - Request: `query { - Book { - name - author { - name - } - } - }`, - Docs: map[int][]string{ - //books - 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9 - }`, - // "bae-ad4ad79c-278d-55cd-a9e3-85f3bc9a0947" - `{ - "name": "Go Guide for Rust developers", - "rating": 5.0 - }`, + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: Book @primary + } + `, }, - //authors - 1: { - // "bae-3bfe0092-e31f-5ebe-a3ba-fa18fac448a6" - `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, - // "bae-756c2bf0-4767-57fd-b12b-393915feae68", - `{ - "name": "Andrew Lone", - "age": 30, - "verified": true, - "published_id": "bae-ad4ad79c-278d-55cd-a9e3-85f3bc9a0947" - }`, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + }, }, - }, - Results: []map[string]any{ - { - "name": "Go Guide for Rust developers", - "author": map[string]any{ - "name": "Andrew Lone", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Go Guide for Rust developers", + "rating": 5.0, }, }, - { - "name": "Painted House", - "author": map[string]any{ - "name": "John Grisham", + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, + }, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Andrew Lone", + "age": 30, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 1), + }, + }, + testUtils.Request{ + Request: `query { + Book { + name + author { + name + } + } + }`, + Results: []map[string]any{ + { + "name": "Go Guide for Rust developers", + "author": map[string]any{ + "name": "Andrew Lone", + }, + }, + { + "name": "Painted House", + "author": map[string]any{ + "name": "John Grisham", + }, + }, }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToOneWithMultipleRecordsSecondaryDirection(t *testing.T) { - test := testUtils.RequestTestCase{ + test := testUtils.TestCase{ Description: "One-to-one-to-one relation secondary direction", - Request: `query { - Author { - name - published { - name - } - } - }`, - Docs: map[int][]string{ - //books - 0: { - // "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - `{ + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author + } + + type Author { + name: String + age: Int + verified: Boolean + published: Book @primary + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 0, + Doc: `{ "name": "Painted House" }`, - // "bae-c2f3f08b-53f2-5b53-9a9f-da1eee096321" - `{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + Doc: `{ "name": "Theif Lord" }`, }, - //authors - 1: { - `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, - `{ - "name": "Cornelia Funke", - "published_id": "bae-c2f3f08b-53f2-5b53-9a9f-da1eee096321" - }`, + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "published": map[string]any{ - "name": "Painted House", + testUtils.CreateDoc{ + CollectionID: 1, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(0, 1), }, }, - { - "name": "Cornelia Funke", - "published": map[string]any{ - "name": "Theif Lord", + testUtils.Request{ + Request: `query { + Author { + name + published { + name + } + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "published": map[string]any{ + "name": "Theif Lord", + }, + }, + { + "name": "John Grisham", + "published": map[string]any{ + "name": "Painted House", + }, + }, }, }, }, } - executeTestCase(t, test) + testUtils.ExecuteTestCase(t, test) } func TestQueryOneToOneWithNilChild(t *testing.T) { @@ -301,7 +343,6 @@ func TestQueryOneToOne_WithRelationIDFromPrimarySide(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 CollectionID: 0, Doc: `{ "name": "Painted House" @@ -309,10 +350,10 @@ func TestQueryOneToOne_WithRelationIDFromPrimarySide(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -324,7 +365,7 @@ func TestQueryOneToOne_WithRelationIDFromPrimarySide(t *testing.T) { Results: []map[string]any{ { "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76", + "published_id": "bae-514f04b1-b218-5b8c-89ee-538f150a32b5", }, }, }, @@ -352,7 +393,6 @@ func TestQueryOneToOne_WithRelationIDFromSecondarySide(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 CollectionID: 0, Doc: `{ "name": "Painted House" @@ -360,10 +400,10 @@ func TestQueryOneToOne_WithRelationIDFromSecondarySide(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -375,7 +415,7 @@ func TestQueryOneToOne_WithRelationIDFromSecondarySide(t *testing.T) { Results: []map[string]any{ { "name": "Painted House", - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", }, }, }, diff --git a/tests/integration/query/one_to_one/with_clashing_id_field_test.go b/tests/integration/query/one_to_one/with_clashing_id_field_test.go index 1dd97572ca..368ea364a4 100644 --- a/tests/integration/query/one_to_one/with_clashing_id_field_test.go +++ b/tests/integration/query/one_to_one/with_clashing_id_field_test.go @@ -36,7 +36,6 @@ func TestQueryOneToOneWithClashingIdFieldOnSecondary(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-d82dbe47-9df1-5e33-bd87-f92e9c378161 CollectionID: 0, Doc: `{ "name": "Painted House", @@ -45,10 +44,10 @@ func TestQueryOneToOneWithClashingIdFieldOnSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-d82dbe47-9df1-5e33-bd87-f92e9c378161" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -63,7 +62,7 @@ func TestQueryOneToOneWithClashingIdFieldOnSecondary(t *testing.T) { Results: []map[string]any{ { "name": "Painted House", - "author_id": "bae-9d67a886-64e3-520b-8cd5-1ca7b098fabe", + "author_id": "bae-1a0405fa-e17d-5b0f-8fe2-eb966938df1c", "author": map[string]any{ "name": "John Grisham", }, diff --git a/tests/integration/query/one_to_one/with_count_filter_test.go b/tests/integration/query/one_to_one/with_count_filter_test.go index d5f2b60d22..9748bb7ca8 100644 --- a/tests/integration/query/one_to_one/with_count_filter_test.go +++ b/tests/integration/query/one_to_one/with_count_filter_test.go @@ -25,7 +25,6 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -33,7 +32,6 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi }, testUtils.CreateDoc{ CollectionID: 0, - // bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6 Doc: `{ "name": "Some Book", "rating": 4.0 @@ -41,7 +39,6 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi }, testUtils.CreateDoc{ CollectionID: 0, - // bae-1c890922-ddf9-5820-a888-c7f977848934 Doc: `{ "name": "Some Other Book", "rating": 3.5 @@ -49,7 +46,6 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi }, testUtils.CreateDoc{ CollectionID: 0, - // TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation Doc: `{ "name": "Yet Another Book", "rating": 3.0 @@ -57,40 +53,39 @@ func TestQueryOneToOneWithCountWithCompoundOrFilterThatIncludesRelation(t *testi }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Writer", - "age": 45, - "verified": false, - "published_id": "bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6" - }`, + DocMap: map[string]any{ + "name": "Some Writer", + "age": 45, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Other Writer", - "age": 35, - "verified": false, - "published_id": "bae-1c890922-ddf9-5820-a888-c7f977848934" - }`, + DocMap: map[string]any{ + "name": "Some Other Writer", + "age": 35, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 2), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Yet Another Writer", - "age": 30, - "verified": false, - "published_id": "TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation" - }`, + DocMap: map[string]any{ + "name": "Yet Another Writer", + "age": 30, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 3), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_one/with_filter_order_test.go b/tests/integration/query/one_to_one/with_filter_order_test.go index 363302abc8..7ec7d88362 100644 --- a/tests/integration/query/one_to_one/with_filter_order_test.go +++ b/tests/integration/query/one_to_one/with_filter_order_test.go @@ -31,12 +31,12 @@ func TestOnetoOneSubTypeDscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -49,14 +49,14 @@ func TestOnetoOneSubTypeDscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // "bae-08519989-280d-5a4d-90b2-915ea06df3c4" `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, @@ -90,12 +90,12 @@ func TestOnetoOneSubTypeAscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -108,14 +108,14 @@ func TestOnetoOneSubTypeAscOrderByQueryWithFilterHavinghNoSubTypeSelections(t *t "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // "bae-08519989-280d-5a4d-90b2-915ea06df3c4" `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, diff --git a/tests/integration/query/one_to_one/with_filter_test.go b/tests/integration/query/one_to_one/with_filter_test.go index ab13634667..c9ae69f637 100644 --- a/tests/integration/query/one_to_one/with_filter_test.go +++ b/tests/integration/query/one_to_one/with_filter_test.go @@ -25,7 +25,6 @@ func TestQueryOneToOneWithNumericFilterOnParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -33,13 +32,12 @@ func TestQueryOneToOneWithNumericFilterOnParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -78,7 +76,7 @@ func TestQueryOneToOneWithStringFilterOnChild(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9 @@ -86,12 +84,12 @@ func TestQueryOneToOneWithStringFilterOnChild(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 Doc: `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ @@ -131,7 +129,7 @@ func TestQueryOneToOneWithBooleanFilterOnChild(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 Doc: `{ "name": "Painted House", "rating": 4.9 @@ -139,12 +137,12 @@ func TestQueryOneToOneWithBooleanFilterOnChild(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 Doc: `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, }, testUtils.Request{ @@ -184,7 +182,6 @@ func TestQueryOneToOneWithFilterThroughChildBackToParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -192,7 +189,6 @@ func TestQueryOneToOneWithFilterThroughChildBackToParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 Doc: `{ "name": "Theif Lord", "rating": 4.8 @@ -200,23 +196,21 @@ func TestQueryOneToOneWithFilterThroughChildBackToParent(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - Doc: `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "age": 62, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -255,7 +249,6 @@ func TestQueryOneToOneWithBooleanFilterOnChildWithNoSubTypeSelection(t *testing. }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -263,13 +256,12 @@ func TestQueryOneToOneWithBooleanFilterOnChildWithNoSubTypeSelection(t *testing. }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -298,7 +290,6 @@ func TestQueryOneToOneWithCompoundAndFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -306,7 +297,6 @@ func TestQueryOneToOneWithCompoundAndFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6 Doc: `{ "name": "Some Book", "rating": 4.0 @@ -314,7 +304,6 @@ func TestQueryOneToOneWithCompoundAndFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-500a9445-bd90-580e-9191-d2d0ec1a5cf5 Doc: `{ "name": "Some Other Book", "rating": 3.0 @@ -322,31 +311,30 @@ func TestQueryOneToOneWithCompoundAndFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Writer", - "age": 45, - "verified": false, - "published_id": "bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6" - }`, + DocMap: map[string]any{ + "name": "Some Writer", + "age": 45, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Other Writer", - "age": 30, - "verified": true, - "published_id": "bae-500a9445-bd90-580e-9191-d2d0ec1a5cf5" - }`, + DocMap: map[string]any{ + "name": "Some Other Writer", + "age": 30, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 2), + }, }, testUtils.Request{ Request: `query { @@ -378,7 +366,6 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -386,7 +373,6 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6 Doc: `{ "name": "Some Book", "rating": 4.0 @@ -394,7 +380,6 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-1c890922-ddf9-5820-a888-c7f977848934 Doc: `{ "name": "Some Other Book", "rating": 3.5 @@ -402,7 +387,6 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation Doc: `{ "name": "Yet Another Book", "rating": 3.0 @@ -410,40 +394,39 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Writer", - "age": 45, - "verified": false, - "published_id": "bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6" - }`, + DocMap: map[string]any{ + "name": "Some Writer", + "age": 45, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Some Other Writer", - "age": 35, - "verified": false, - "published_id": "bae-1c890922-ddf9-5820-a888-c7f977848934" - }`, + DocMap: map[string]any{ + "name": "Some Other Writer", + "age": 35, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 2), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Yet Another Writer", - "age": 30, - "verified": false, - "published_id": "TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation" - }`, + DocMap: map[string]any{ + "name": "Yet Another Writer", + "age": 30, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 3), + }, }, testUtils.Request{ Request: `query { @@ -462,10 +445,10 @@ func TestQueryOneToOneWithCompoundOrFilterThatIncludesRelation(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Some Other Book", + "name": "Some Book", }, { - "name": "Some Book", + "name": "Some Other Book", }, }, }, @@ -502,7 +485,6 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul }, testUtils.CreateDoc{ CollectionID: 0, - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d Doc: `{ "name": "Painted House", "rating": 4.9 @@ -510,7 +492,6 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul }, testUtils.CreateDoc{ CollectionID: 0, - // bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6 Doc: `{ "name": "Some Book", "rating": 4.0 @@ -518,7 +499,6 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul }, testUtils.CreateDoc{ CollectionID: 0, - // bae-66ba0c48-4984-5b44-83dd-edb791a54b7d Doc: `{ "name": "Some Other Book", "rating": 3.0 @@ -526,33 +506,30 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul }, testUtils.CreateDoc{ CollectionID: 1, - // bae-3bfe0092-e31f-5ebe-a3ba-fa18fac448a6 - Doc: `{ - "name": "John Grisham", - "age": 65, - "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "age": 65, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-5dac8488-0f75-5ddf-b08b-804b3d33a239 - Doc: `{ - "name": "Some Writer", - "age": 45, - "verified": false, - "published_id": "bae-437092f3-7817-555c-bf8a-cc1c5a0a0db6" - }`, + DocMap: map[string]any{ + "name": "Some Writer", + "age": 45, + "verified": false, + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-8b0c345b-dda7-573c-b5f1-5fa1d70593e1 - Doc: `{ - "name": "Some Other Writer", - "age": 30, - "verified": true, - "published_id": "bae-66ba0c48-4984-5b44-83dd-edb791a54b7d" - }`, + DocMap: map[string]any{ + "name": "Some Other Writer", + "age": 30, + "verified": true, + "published_id": testUtils.NewDocIndex(0, 2), + }, }, testUtils.Request{ Request: `query { @@ -565,14 +542,14 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul } }`, Results: []map[string]any{ - { - "name": "Some Other Book", - "rating": 3.0, - }, { "name": "Painted House", "rating": 4.9, }, + { + "name": "Some Other Book", + "rating": 3.0, + }, }, }, testUtils.Request{ @@ -604,14 +581,14 @@ func TestQueryOneToOne_WithCompoundFiltersThatIncludesRelation_ShouldReturnResul } }`, Results: []map[string]any{ - { - "name": "Some Other Book", - "rating": 3.0, - }, { "name": "Painted House", "rating": 4.9, }, + { + "name": "Some Other Book", + "rating": 3.0, + }, }, }, }, diff --git a/tests/integration/query/one_to_one/with_group_related_id_alias_test.go b/tests/integration/query/one_to_one/with_group_related_id_alias_test.go index eb53ab5d47..1f98f6604b 100644 --- a/tests/integration/query/one_to_one/with_group_related_id_alias_test.go +++ b/tests/integration/query/one_to_one/with_group_related_id_alias_test.go @@ -35,33 +35,29 @@ func TestQueryOneToOneWithGroupRelatedIDAlias(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -77,7 +73,7 @@ func TestQueryOneToOneWithGroupRelatedIDAlias(t *testing.T) { }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", "author": map[string]any{ "name": "John Grisham", }, @@ -88,7 +84,7 @@ func TestQueryOneToOneWithGroupRelatedIDAlias(t *testing.T) { }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-b11e00fc-340f-558b-909d-2ab94601570b", "author": map[string]any{ "name": "Andrew Lone", }, @@ -125,33 +121,29 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroup(t *t }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -161,10 +153,10 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroup(t *t }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", }, }, }, @@ -193,33 +185,29 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroupWithJ }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -232,15 +220,15 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithoutInnerGroupWithJ }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", "author": map[string]any{ - "name": "John Grisham", + "name": "Andrew Lone", }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "author": map[string]any{ - "name": "Andrew Lone", + "name": "John Grisham", }, }, }, @@ -270,33 +258,29 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroup(t *test }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -309,18 +293,18 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroup(t *test }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", "_group": []map[string]any{ { - "name": "Painted House", + "name": "Go Guide for Rust developers", }, }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "_group": []map[string]any{ { - "name": "Go Guide for Rust developers", + "name": "Painted House", }, }, }, @@ -351,33 +335,29 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroupWithJoin }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -393,24 +373,24 @@ func TestQueryOneToOneWithGroupRelatedIDAliasFromSecondaryWithInnerGroupWithJoin }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", "author": map[string]any{ - "name": "John Grisham", + "name": "Andrew Lone", }, "_group": []map[string]any{ { - "name": "Painted House", + "name": "Go Guide for Rust developers", }, }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "author": map[string]any{ - "name": "Andrew Lone", + "name": "John Grisham", }, "_group": []map[string]any{ { - "name": "Go Guide for Rust developers", + "name": "Painted House", }, }, }, diff --git a/tests/integration/query/one_to_one/with_group_related_id_test.go b/tests/integration/query/one_to_one/with_group_related_id_test.go index 45b432192d..d3b9867886 100644 --- a/tests/integration/query/one_to_one/with_group_related_id_test.go +++ b/tests/integration/query/one_to_one/with_group_related_id_test.go @@ -35,33 +35,29 @@ func TestQueryOneToOneWithGroupRelatedID(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -74,7 +70,7 @@ func TestQueryOneToOneWithGroupRelatedID(t *testing.T) { }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-077b5e8d-5a86-5ae7-a321-ac7e423bb260", "_group": []map[string]any{ { "name": "Painted House", @@ -82,7 +78,7 @@ func TestQueryOneToOneWithGroupRelatedID(t *testing.T) { }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-cfee1ed9-ede8-5b80-a6fa-78c727a076ac", "_group": []map[string]any{ { "name": "Go Guide for Rust developers", @@ -116,33 +112,29 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroup(t *testing.T) }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -152,10 +144,10 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroup(t *testing.T) }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", }, }, }, @@ -184,33 +176,29 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroupWithJoin(t *tes }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -223,15 +211,15 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithoutGroupWithJoin(t *tes }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", "author": map[string]any{ - "name": "John Grisham", + "name": "Andrew Lone", }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "author": map[string]any{ - "name": "Andrew Lone", + "name": "John Grisham", }, }, }, @@ -261,33 +249,29 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroup(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -300,18 +284,18 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroup(t *testing.T) { }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-bb4d6e89-e8b4-5eec-bfeb-6f7aa4840950", "_group": []map[string]any{ { - "name": "Painted House", + "name": "Go Guide for Rust developers", }, }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "_group": []map[string]any{ { - "name": "Go Guide for Rust developers", + "name": "Painted House", }, }, }, @@ -342,33 +326,29 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroupWithJoin(t *testin }, testUtils.CreateDoc{ CollectionID: 0, - // bae-3d236f89-6a31-5add-a36a-27971a2eac76 Doc: `{ "name": "Painted House" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6 Doc: `{ "name": "Go Guide for Rust developers" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-6b624301-3d0a-5336-bd2c-ca00bca3de85 - Doc: `{ - "name": "John Grisham", - "published_id": "bae-3d236f89-6a31-5add-a36a-27971a2eac76" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c - Doc: `{ - "name": "Andrew Lone", - "published_id": "bae-d6627fea-8bf7-511c-bcf9-bac4212bddd6" - }`, + DocMap: map[string]any{ + "name": "Andrew Lone", + "published_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.Request{ Request: `query { @@ -384,24 +364,24 @@ func TestQueryOneToOneWithGroupRelatedIDFromSecondaryWithGroupWithJoin(t *testin }`, Results: []map[string]any{ { - "author_id": "bae-6b624301-3d0a-5336-bd2c-ca00bca3de85", + "author_id": "bae-3c308f94-dc9e-5262-b0ce-ef4e8e545820", "author": map[string]any{ - "name": "John Grisham", + "name": "Andrew Lone", }, "_group": []map[string]any{ { - "name": "Painted House", + "name": "Go Guide for Rust developers", }, }, }, { - "author_id": "bae-92fa9dcb-c1ee-5b84-b2f6-e9437c7f261c", + "author_id": "bae-420e72a6-e0c6-5a06-a958-2cc7adb7b3d0", "author": map[string]any{ - "name": "Andrew Lone", + "name": "John Grisham", }, "_group": []map[string]any{ { - "name": "Go Guide for Rust developers", + "name": "Painted House", }, }, }, diff --git a/tests/integration/query/one_to_one/with_order_test.go b/tests/integration/query/one_to_one/with_order_test.go index eca937539a..bdf5d6d1e3 100644 --- a/tests/integration/query/one_to_one/with_order_test.go +++ b/tests/integration/query/one_to_one/with_order_test.go @@ -32,12 +32,12 @@ func TestQueryOneToOneWithChildBooleanOrderDescending(t *testing.T) { Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -45,19 +45,19 @@ func TestQueryOneToOneWithChildBooleanOrderDescending(t *testing.T) { }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, @@ -100,12 +100,12 @@ func TestQueryOneToOneWithChildBooleanOrderAscending(t *testing.T) { Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -113,19 +113,19 @@ func TestQueryOneToOneWithChildBooleanOrderAscending(t *testing.T) { }, //authors 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 + // bae-7aabc9d2-fbbc-5911-b0d0-b49a2a1d0e84 `{ "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, @@ -164,12 +164,12 @@ func TestQueryOneToOneWithChildIntOrderDescendingWithNoSubTypeFieldsSelected(t * Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -182,14 +182,14 @@ func TestQueryOneToOneWithChildIntOrderDescendingWithNoSubTypeFieldsSelected(t * "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // "bae-08519989-280d-5a4d-90b2-915ea06df3c4" `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, @@ -220,12 +220,12 @@ func TestQueryOneToOneWithChildIntOrderAscendingWithNoSubTypeFieldsSelected(t *t Docs: map[int][]string{ //books 0: { - // bae-fd541c25-229e-5280-b44b-e5c2af3e374d + // bae-be6d8024-4953-5a92-84b4-f042d25230c6 `{ "name": "Painted House", "rating": 4.9 }`, - // bae-d432bdfb-787d-5a1c-ac29-dc025ab80095 + // bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b `{ "name": "Theif Lord", "rating": 4.8 @@ -238,14 +238,14 @@ func TestQueryOneToOneWithChildIntOrderAscendingWithNoSubTypeFieldsSelected(t *t "name": "John Grisham", "age": 65, "verified": true, - "published_id": "bae-fd541c25-229e-5280-b44b-e5c2af3e374d" + "published_id": "bae-be6d8024-4953-5a92-84b4-f042d25230c6" }`, // "bae-08519989-280d-5a4d-90b2-915ea06df3c4" `{ "name": "Cornelia Funke", "age": 62, "verified": false, - "published_id": "bae-d432bdfb-787d-5a1c-ac29-dc025ab80095" + "published_id": "bae-26a28d23-ae5b-5257-91b7-d4f2c6abef7b" }`, }, }, diff --git a/tests/integration/query/one_to_one_multiple/simple_test.go b/tests/integration/query/one_to_one_multiple/simple_test.go index cc5a97c117..f7988a1940 100644 --- a/tests/integration/query/one_to_one_multiple/simple_test.go +++ b/tests/integration/query/one_to_one_multiple/simple_test.go @@ -41,47 +41,43 @@ func TestQueryOneToOneMultiple_FromPrimary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed Doc: `{ "name": "John Grisham" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3 Doc: `{ "name": "Cornelia Funke" }`, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d", - "author_id": "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5", - "author_id": "bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + "author_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -147,47 +143,43 @@ func TestQueryOneToOneMultiple_FromMixedPrimaryAndSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed Doc: `{ "name": "John Grisham" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3 Doc: `{ "name": "Cornelia Funke" }`, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d", - "author_id": "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5", - "author_id": "bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + "author_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -203,21 +195,21 @@ func TestQueryOneToOneMultiple_FromMixedPrimaryAndSecondary(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Painted House", + "name": "Theif Lord", "publisher": map[string]any{ - "name": "Old Publisher", + "name": "New Publisher", }, "author": map[string]any{ - "name": "John Grisham", + "name": "Cornelia Funke", }, }, { - "name": "Theif Lord", + "name": "Painted House", "publisher": map[string]any{ - "name": "New Publisher", + "name": "Old Publisher", }, "author": map[string]any{ - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, @@ -253,47 +245,43 @@ func TestQueryOneToOneMultiple_FromSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed Doc: `{ "name": "John Grisham" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3 Doc: `{ "name": "Cornelia Funke" }`, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d", - "author_id": "bae-2edb7fdd-cad7-5ad4-9c7d-6920245a96ed" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + "author_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5", - "author_id": "bae-b6ea52b8-a5a5-5127-b9c0-5df4243457a3" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + "author_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_one_to_many/simple_test.go b/tests/integration/query/one_to_one_to_many/simple_test.go index 184d2eae1b..cee2d465cf 100644 --- a/tests/integration/query/one_to_one_to_many/simple_test.go +++ b/tests/integration/query/one_to_one_to_many/simple_test.go @@ -41,25 +41,23 @@ func TestQueryOneToOneToMany(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-5d900ac7-8bef-5565-9040-364c99601ae0 Doc: `{ "name": "Indicator1" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-14b75d37-f17d-58f0-89a8-43f2ec067122 - Doc: `{ - "name": "Observable1", - "indicator_id": "bae-5d900ac7-8bef-5565-9040-364c99601ae0" - }`, + DocMap: map[string]any{ + "name": "Observable1", + "indicator_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Observation1", - "observable_id": "bae-14b75d37-f17d-58f0-89a8-43f2ec067122" - }`, + DocMap: map[string]any{ + "name": "Observation1", + "observable_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: `query { @@ -116,25 +114,23 @@ func TestQueryOneToOneToManyFromSecondaryOnOneToMany(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-5d900ac7-8bef-5565-9040-364c99601ae0 Doc: `{ "name": "Indicator1" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-14b75d37-f17d-58f0-89a8-43f2ec067122 - Doc: `{ - "name": "Observable1", - "indicator_id": "bae-5d900ac7-8bef-5565-9040-364c99601ae0" - }`, + DocMap: map[string]any{ + "name": "Observable1", + "indicator_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Observation1", - "observable_id": "bae-14b75d37-f17d-58f0-89a8-43f2ec067122" - }`, + DocMap: map[string]any{ + "name": "Observation1", + "observable_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: `query { @@ -193,25 +189,23 @@ func TestQueryOneToOneToManyFromSecondaryOnOneToOne(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-5d900ac7-8bef-5565-9040-364c99601ae0 Doc: `{ "name": "Indicator1" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-14b75d37-f17d-58f0-89a8-43f2ec067122 - Doc: `{ - "name": "Observable1", - "indicator_id": "bae-5d900ac7-8bef-5565-9040-364c99601ae0" - }`, + DocMap: map[string]any{ + "name": "Observable1", + "indicator_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Observation1", - "observable_id": "bae-14b75d37-f17d-58f0-89a8-43f2ec067122" - }`, + DocMap: map[string]any{ + "name": "Observation1", + "observable_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: `query { @@ -268,25 +262,23 @@ func TestQueryOneToOneToManyFromSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // bae-5d900ac7-8bef-5565-9040-364c99601ae0 Doc: `{ "name": "Indicator1" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // bae-14b75d37-f17d-58f0-89a8-43f2ec067122 - Doc: `{ - "name": "Observable1", - "indicator_id": "bae-5d900ac7-8bef-5565-9040-364c99601ae0" - }`, + DocMap: map[string]any{ + "name": "Observable1", + "indicator_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Observation1", - "observable_id": "bae-14b75d37-f17d-58f0-89a8-43f2ec067122" - }`, + DocMap: map[string]any{ + "name": "Observation1", + "observable_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_one_to_one/simple_test.go b/tests/integration/query/one_to_one_to_one/simple_test.go index 11f75e38f9..e788ddc732 100644 --- a/tests/integration/query/one_to_one_to_one/simple_test.go +++ b/tests/integration/query/one_to_one_to_one/simple_test.go @@ -41,47 +41,43 @@ func TestQueryOneToOneToOne(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Cornelia Funke", - "published_id": "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -97,20 +93,20 @@ func TestQueryOneToOneToOne(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Old Publisher", + "name": "New Publisher", "printed": map[string]any{ - "name": "Painted House", + "name": "Theif Lord", "author": map[string]any{ - "name": "John Grisham", + "name": "Cornelia Funke", }, }, }, { - "name": "New Publisher", + "name": "Old Publisher", "printed": map[string]any{ - "name": "Theif Lord", + "name": "Painted House", "author": map[string]any{ - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, @@ -147,47 +143,43 @@ func TestQueryOneToOneToOneSecondaryThenPrimary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Cornelia Funke", - "published_id": "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -203,20 +195,20 @@ func TestQueryOneToOneToOneSecondaryThenPrimary(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Old Publisher", + "name": "New Publisher", "printed": map[string]any{ - "name": "Painted House", + "name": "Theif Lord", "author": map[string]any{ - "name": "John Grisham", + "name": "Cornelia Funke", }, }, }, { - "name": "New Publisher", + "name": "Old Publisher", "printed": map[string]any{ - "name": "Theif Lord", + "name": "Painted House", "author": map[string]any{ - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, @@ -253,47 +245,43 @@ func TestQueryOneToOneToOnePrimaryThenSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Cornelia Funke", - "published_id": "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -309,20 +297,20 @@ func TestQueryOneToOneToOnePrimaryThenSecondary(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Old Publisher", + "name": "New Publisher", "printed": map[string]any{ - "name": "Painted House", + "name": "Theif Lord", "author": map[string]any{ - "name": "John Grisham", + "name": "Cornelia Funke", }, }, }, { - "name": "New Publisher", + "name": "Old Publisher", "printed": map[string]any{ - "name": "Theif Lord", + "name": "Painted House", "author": map[string]any{ - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, @@ -359,47 +347,43 @@ func TestQueryOneToOneToOneSecondary(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Cornelia Funke", - "published_id": "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { @@ -415,20 +399,20 @@ func TestQueryOneToOneToOneSecondary(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Old Publisher", + "name": "New Publisher", "printed": map[string]any{ - "name": "Painted House", + "name": "Theif Lord", "author": map[string]any{ - "name": "John Grisham", + "name": "Cornelia Funke", }, }, }, { - "name": "New Publisher", + "name": "Old Publisher", "printed": map[string]any{ - "name": "Theif Lord", + "name": "Painted House", "author": map[string]any{ - "name": "Cornelia Funke", + "name": "John Grisham", }, }, }, diff --git a/tests/integration/query/one_to_one_to_one/with_order_test.go b/tests/integration/query/one_to_one_to_one/with_order_test.go index c5da7a19e7..899f890f74 100644 --- a/tests/integration/query/one_to_one_to_one/with_order_test.go +++ b/tests/integration/query/one_to_one_to_one/with_order_test.go @@ -41,47 +41,43 @@ func TestQueryOneToOneToOneWithNestedOrder(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" Doc: `{ "name": "Old Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 0, - // "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" Doc: `{ "name": "New Publisher" }`, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - Doc: `{ - "name": "Painted House", - "publisher_id": "bae-1f4cc394-08a8-5825-87b9-b02de2f25f7d" - }`, + DocMap: map[string]any{ + "name": "Painted House", + "publisher_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - // "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - Doc: `{ - "name": "Theif Lord", - "publisher_id": "bae-a3cd6fac-13c0-5c8f-970b-0ce7abbb49a5" - }`, + DocMap: map[string]any{ + "name": "Theif Lord", + "publisher_id": testUtils.NewDocIndex(0, 1), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "John Grisham", - "published_id": "bae-a6cdabfc-17dd-5662-b213-c596ee4c3292" - }`, + DocMap: map[string]any{ + "name": "John Grisham", + "published_id": testUtils.NewDocIndex(1, 0), + }, }, testUtils.CreateDoc{ CollectionID: 2, - Doc: `{ - "name": "Cornelia Funke", - "published_id": "bae-bc198c5f-6238-5b50-8072-68dec9c7a16b" - }`, + DocMap: map[string]any{ + "name": "Cornelia Funke", + "published_id": testUtils.NewDocIndex(1, 1), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/query/one_to_two_many/simple_test.go b/tests/integration/query/one_to_two_many/simple_test.go index 6768c9e9b9..58a677d6fa 100644 --- a/tests/integration/query/one_to_two_many/simple_test.go +++ b/tests/integration/query/one_to_two_many/simple_test.go @@ -16,185 +16,403 @@ import ( testUtils "github.com/sourcenetwork/defradb/tests/integration" ) -func TestQueryOneToTwoManyWithNilUnnamedRelationship(t *testing.T) { - tests := []testUtils.RequestTestCase{ - { - Description: "One-to-many relation query from one side", - Request: `query { - Book { +func TestQueryOneToTwoManyWithNilUnnamedRelationship_FromOneSide(t *testing.T) { + test := testUtils.TestCase{ + Description: "One-to-many relation query from one side", + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author @relation(name: "written_books") + reviewedBy: Author @relation(name: "reviewed_books") + } + + type Author { + name: String + age: Int + verified: Boolean + written: [Book] @relation(name: "written_books") + reviewed: [Book] @relation(name: "reviewed_books") + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "John Grisham", + "age": 65, + "verified": true + }`, + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "Cornelia Funke", + "age": 62, + "verified": false + }`, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.Request{ + Request: `query { + Book { + name + rating + author { name - rating - author { - name - } - reviewedBy { - name - age - } } - }`, - Docs: map[int][]string{ - //books - 0: { - `{ - "name": "Painted House", + reviewedBy { + name + age + } + } + }`, + Results: []map[string]any{ + { + "name": "Painted House", "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "A Time for Mercy", + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, + }, + { + "name": "A Time for Mercy", "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "Theif Lord", + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), + }, + }, + { + "name": "Theif Lord", "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + "author": map[string]any{ + "name": "Cornelia Funke", + }, + "reviewedBy": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, + }, }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + }, + }, + } + + testUtils.ExecuteTestCase(t, test) +} + +func TestQueryOneToTwoManyWithNilUnnamedRelationship_FromManySide(t *testing.T) { + test := testUtils.TestCase{ + Description: "One-to-many relation query from many side", + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author @relation(name: "written_books") + reviewedBy: Author @relation(name: "reviewed_books") + } + + type Author { + name: String + age: Int + verified: Boolean + written: [Book] @relation(name: "written_books") + reviewed: [Book] @relation(name: "reviewed_books") + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "John Grisham", + "age": 65, + "verified": true + }`, + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "Cornelia Funke", + "age": 62, + "verified": false + }`, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), }, }, - Results: []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), }, - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + age + written { + name + } + reviewed { + name + rating + } + } + }`, + Results: []map[string]any{ + { "name": "Cornelia Funke", + "age": int64(62), + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, + }, + "written": []map[string]any{ + { + "name": "Theif Lord", + }, + }, }, - "reviewedBy": map[string]any{ + { "name": "John Grisham", "age": int64(65), - }, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + }, + "written": []map[string]any{ + { + "name": "Painted House", + }, + { + "name": "A Time for Mercy", + }, + }, }, }, }, }, - { - Description: "One-to-many relation query from many side", - Request: `query { - Author { - name - age - written { - name + } + + testUtils.ExecuteTestCase(t, test) +} + +func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships(t *testing.T) { + test := testUtils.TestCase{ + Description: "One-to-many relation query from one side", + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + price: Price + author: Author @relation(name: "written_books") + reviewedBy: Author @relation(name: "reviewed_books") } - reviewed { - name - rating + + type Author { + name: String + age: Int + verified: Boolean + written: [Book] @relation(name: "written_books") + reviewed: [Book] @relation(name: "reviewed_books") } - } - }`, - Docs: map[int][]string{ - //books - 0: { // bae-fd541c25-229e-5280-b44b-e5c2af3e374d - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" + + type Price { + currency: String + value: Float + books: [Book] + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 2, + Doc: `{ + "currency": "GBP", + "value": 12.99 }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" + }, + testUtils.CreateDoc{ + CollectionID: 2, + Doc: `{ + "currency": "SEK", + "value": 129 }`, - }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + "price_id": testUtils.NewDocIndex(2, 0), }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + "price_id": testUtils.NewDocIndex(2, 1), + }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), + "price_id": testUtils.NewDocIndex(2, 0), + }, + }, + testUtils.Request{ + Request: `query { + Book { + name + rating + author { + name + } + reviewedBy { + name + age + } + price { + currency + value + } + } + }`, + Results: []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + "author": map[string]any{ + "name": "John Grisham", }, - }, - "written": []map[string]any{ - { - "name": "Painted House", + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), }, - { - "name": "A Time for Mercy", + "price": map[string]any{ + "currency": "GBP", + "value": 12.99, }, }, - }, - { - "name": "Cornelia Funke", - "age": int64(62), - "reviewed": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "name": "A Time for Mercy", + "rating": 4.5, + "author": map[string]any{ + "name": "John Grisham", + }, + "reviewedBy": map[string]any{ + "name": "Cornelia Funke", + "age": int64(62), }, - { - "name": "A Time for Mercy", - "rating": 4.5, + "price": map[string]any{ + "currency": "SEK", + "value": float64(129), }, }, - "written": []map[string]any{ - { - "name": "Theif Lord", + { + "name": "Theif Lord", + "rating": 4.8, + "author": map[string]any{ + "name": "Cornelia Funke", + }, + "reviewedBy": map[string]any{ + "name": "John Grisham", + "age": int64(65), + }, + "price": map[string]any{ + "currency": "GBP", + "value": 12.99, }, }, }, @@ -202,247 +420,159 @@ func TestQueryOneToTwoManyWithNilUnnamedRelationship(t *testing.T) { }, } - for _, test := range tests { - executeTestCase(t, test) - } + testUtils.ExecuteTestCase(t, test) } -func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships(t *testing.T) { - tests := []testUtils.RequestTestCase{ - { - Description: "One-to-many relation query from one side", - Request: `query { - Book { - name - rating - author { - name - } - reviewedBy { - name - age - } - price { - currency - value - } +func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships_FromManySide(t *testing.T) { + test := testUtils.TestCase{ + Description: "One-to-many relation query from many side", + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + price: Price + author: Author @relation(name: "written_books") + reviewedBy: Author @relation(name: "reviewed_books") } + + type Author { + name: String + age: Int + verified: Boolean + written: [Book] @relation(name: "written_books") + reviewed: [Book] @relation(name: "reviewed_books") + } + + type Price { + currency: String + value: Float + books: [Book] + } + `, + }, + testUtils.CreateDoc{ + CollectionID: 2, + Doc: `{ + "currency": "GBP", + "value": 12.99 }`, - Docs: map[int][]string{ - //books - 0: { - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "price_id": "bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "price_id": "bae-b4b58dab-7bc3-5a3a-a26b-63d9d555116d" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "price_id": "bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd" + }, + testUtils.CreateDoc{ + CollectionID: 2, + Doc: `{ + "currency": "SEK", + "value": 129 }`, - }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "John Grisham", "age": 65, "verified": true }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ "name": "Cornelia Funke", "age": 62, "verified": false }`, - }, - 2: { - // bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd - `{ - "currency": "GBP", - "value": 12.99 - }`, - // bae-b4b58dab-7bc3-5a3a-a26b-63d9d555116d - `{ - "currency": "SEK", - "value": 129 - }`, - }, }, - Results: []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - "author": map[string]any{ - "name": "Cornelia Funke", - }, - "reviewedBy": map[string]any{ - "name": "John Grisham", - "age": int64(65), - }, - "price": map[string]any{ - "currency": "GBP", - "value": 12.99, - }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + "price_id": testUtils.NewDocIndex(2, 0), }, - { - "name": "A Time for Mercy", - "rating": 4.5, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, - "price": map[string]any{ - "currency": "SEK", - "value": float64(129), - }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), + "price_id": testUtils.NewDocIndex(2, 1), }, - { - "name": "Painted House", - "rating": 4.9, - "author": map[string]any{ - "name": "John Grisham", - }, - "reviewedBy": map[string]any{ - "name": "Cornelia Funke", - "age": int64(62), - }, - "price": map[string]any{ - "currency": "GBP", - "value": 12.99, - }, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), + "price_id": testUtils.NewDocIndex(2, 0), }, }, - }, - { - Description: "One-to-many relation query from many side", - Request: `query { - Author { - name - age - written { + testUtils.Request{ + Request: `query { + Author { name - price { - value + age + written { + name + price { + value + } + } + reviewed { + name + rating } } - reviewed { - name - rating - } - } - }`, - Docs: map[int][]string{ - //books - 0: { - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "price_id": "bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "price_id": "bae-b4b58dab-7bc3-5a3a-a26b-63d9d555116d" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "price_id": "bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd" - }`, - }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ + }`, + Results: []map[string]any{ + { "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, - }, - 2: { - // bae-fcc7a01d-6855-5e7a-abdd-261a46dcb9bd - `{ - "currency": "GBP", - "value": 12.99 - }`, - // bae-b4b58dab-7bc3-5a3a-a26b-63d9d555116d - `{ - "currency": "SEK", - "value": 129 - }`, - }, - }, - Results: []map[string]any{ - { - "name": "John Grisham", - "age": int64(65), - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - }, - "written": []map[string]any{ - { - "name": "A Time for Mercy", - "price": map[string]any{ - "value": float64(129), + "age": int64(62), + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, }, }, - { - "name": "Painted House", - "price": map[string]any{ - "value": 12.99, + "written": []map[string]any{ + { + "name": "Theif Lord", + "price": map[string]any{ + "value": 12.99, + }, }, }, }, - }, - { - "name": "Cornelia Funke", - "age": int64(62), - "reviewed": []map[string]any{ - { - "name": "A Time for Mercy", - "rating": 4.5, - }, - { - "name": "Painted House", - "rating": 4.9, + { + "name": "John Grisham", + "age": int64(65), + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, }, - }, - "written": []map[string]any{ - { - "name": "Theif Lord", - "price": map[string]any{ - "value": 12.99, + "written": []map[string]any{ + { + "name": "Painted House", + "price": map[string]any{ + "value": 12.99, + }, + }, + { + "name": "A Time for Mercy", + "price": map[string]any{ + "value": float64(129), + }, }, }, }, @@ -451,7 +581,5 @@ func TestQueryOneToTwoManyWithNamedAndUnnamedRelationships(t *testing.T) { }, } - for _, test := range tests { - executeTestCase(t, test) - } + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/one_to_two_many/utils.go b/tests/integration/query/one_to_two_many/utils.go deleted file mode 100644 index 363a10efe1..0000000000 --- a/tests/integration/query/one_to_two_many/utils.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2022 Democratized Data Foundation -// -// Use of this software is governed by the Business Source License -// included in the file licenses/BSL.txt. -// -// As of the Change Date specified in that file, in accordance with -// the Business Source License, use of this software will be governed -// by the Apache License, Version 2.0, included in the file -// licenses/APL.txt. - -package one_to_two_many - -import ( - "testing" - - testUtils "github.com/sourcenetwork/defradb/tests/integration" -) - -var bookAuthorGQLSchema = (` - type Book { - name: String - rating: Float - price: Price - author: Author @relation(name: "written_books") - reviewedBy: Author @relation(name: "reviewed_books") - } - - type Author { - name: String - age: Int - verified: Boolean - written: [Book] @relation(name: "written_books") - reviewed: [Book] @relation(name: "reviewed_books") - } - - type Price { - currency: String - value: Float - books: [Book] - } -`) - -func executeTestCase(t *testing.T, test testUtils.RequestTestCase) { - testUtils.ExecuteRequestTestCase(t, bookAuthorGQLSchema, []string{"Book", "Author", "Price"}, test) -} diff --git a/tests/integration/query/one_to_two_many/with_order_test.go b/tests/integration/query/one_to_two_many/with_order_test.go index 63f948dfaa..d84aa4e869 100644 --- a/tests/integration/query/one_to_two_many/with_order_test.go +++ b/tests/integration/query/one_to_two_many/with_order_test.go @@ -17,92 +17,118 @@ import ( ) func TestQueryOneToTwoManyWithOrder(t *testing.T) { - tests := []testUtils.RequestTestCase{ - { - Description: "One-to-many relation query from one side, order in opposite directions on children", - Request: `query { - Author { - name - written (order: {rating: ASC}) { - name - } - reviewed (order: {rating: DESC}){ - name - rating - } - } - }`, - Docs: map[int][]string{ - //books - 0: { - `{ - "name": "Painted House", - "rating": 4.9, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04" - }`, - `{ - "name": "A Time for Mercy", - "rating": 4.5, - "author_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, - `{ - "name": "Theif Lord", - "rating": 4.8, - "author_id": "bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04", - "reviewedBy_id": "bae-41598f0c-19bc-5da6-813b-e80f14a10df3" - }`, + test := testUtils.TestCase{ + Description: "One-to-many relation query from one side, order in opposite directions on children", + Actions: []any{ + testUtils.SchemaUpdate{ + Schema: ` + type Book { + name: String + rating: Float + author: Author @relation(name: "written_books") + reviewedBy: Author @relation(name: "reviewed_books") + } + + type Author { + name: String + age: Int + verified: Boolean + written: [Book] @relation(name: "written_books") + reviewed: [Book] @relation(name: "reviewed_books") + } + `, + }, + + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "John Grisham", + "age": 65, + "verified": true + }`, + }, + testUtils.CreateDoc{ + CollectionID: 1, + Doc: `{ + "name": "Cornelia Funke", + "age": 62, + "verified": false + }`, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Painted House", + "rating": 4.9, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 1), }, - //authors - 1: { - // bae-41598f0c-19bc-5da6-813b-e80f14a10df3 - `{ - "name": "John Grisham", - "age": 65, - "verified": true - }`, - // bae-b769708d-f552-5c3d-a402-ccfd7ac7fb04 - `{ - "name": "Cornelia Funke", - "age": 62, - "verified": false - }`, + }, + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "A Time for Mercy", + "rating": 4.5, + "author_id": testUtils.NewDocIndex(1, 0), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), }, }, - Results: []map[string]any{ - { - "name": "John Grisham", - "reviewed": []map[string]any{ - { - "name": "Theif Lord", - "rating": 4.8, - }, - { - "name": "A Time for Mercy", - "rating": 4.5, - }, - }, - "written": []map[string]any{ - { - "name": "A Time for Mercy", + testUtils.CreateDoc{ + CollectionID: 0, + DocMap: map[string]any{ + "name": "Theif Lord", + "rating": 4.8, + "author_id": testUtils.NewDocIndex(1, 1), + "reviewedBy_id": testUtils.NewDocIndex(1, 0), + }, + }, + testUtils.Request{ + Request: `query { + Author { + name + written (order: {rating: ASC}) { + name + } + reviewed (order: {rating: DESC}){ + name + rating + } + } + }`, + Results: []map[string]any{ + { + "name": "Cornelia Funke", + "reviewed": []map[string]any{ + { + "name": "Painted House", + "rating": 4.9, + }, }, - { - "name": "Painted House", + "written": []map[string]any{ + { + "name": "Theif Lord", + }, }, }, - }, - { - "name": "Cornelia Funke", - "reviewed": []map[string]any{ - { - "name": "Painted House", - "rating": 4.9, + { + "name": "John Grisham", + "reviewed": []map[string]any{ + { + "name": "Theif Lord", + "rating": 4.8, + }, + { + "name": "A Time for Mercy", + "rating": 4.5, + }, }, - }, - "written": []map[string]any{ - { - "name": "Theif Lord", + "written": []map[string]any{ + { + "name": "A Time for Mercy", + }, + { + "name": "Painted House", + }, }, }, }, @@ -110,7 +136,5 @@ func TestQueryOneToTwoManyWithOrder(t *testing.T) { }, } - for _, test := range tests { - executeTestCase(t, test) - } + testUtils.ExecuteTestCase(t, test) } diff --git a/tests/integration/query/simple/simple_test.go b/tests/integration/query/simple/simple_test.go index abdc0cd1f3..5872998e81 100644 --- a/tests/integration/query/simple/simple_test.go +++ b/tests/integration/query/simple/simple_test.go @@ -36,7 +36,7 @@ func TestQuerySimple(t *testing.T) { }, Results: []map[string]any{ { - "_docID": "bae-52b9170d-b77a-5887-b877-cbdbb99b009f", + "_docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", "Name": "John", "Age": int64(21), }, diff --git a/tests/integration/query/simple/with_cid_doc_id_test.go b/tests/integration/query/simple/with_cid_doc_id_test.go index 28bd453faf..97791ce993 100644 --- a/tests/integration/query/simple/with_cid_doc_id_test.go +++ b/tests/integration/query/simple/with_cid_doc_id_test.go @@ -93,8 +93,8 @@ func TestQuerySimpleWithCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreifvrmwmlwtglxe3afki36spu6d5qs6vvza57kxs4giyi53r5vbbnu", - docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + cid: "bafyreicceacb554vtciciumodqmz6vmnfvr6uod2hfhnwujmfqx5pgq3fi", + docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc" ) { name } @@ -135,8 +135,8 @@ func TestQuerySimpleWithUpdateAndFirstCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreifvrmwmlwtglxe3afki36spu6d5qs6vvza57kxs4giyi53r5vbbnu", - docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + cid: "bafyreicceacb554vtciciumodqmz6vmnfvr6uod2hfhnwujmfqx5pgq3fi", + docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc" ) { name } @@ -177,8 +177,8 @@ func TestQuerySimpleWithUpdateAndLastCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreihyutx64yvxcfeglc2kax3l4kxrp5mae4p7txrxyiszqybs54h3zq", - docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + cid: "bafyreic3z3mjat7i7nm52jwprew7f7dimyob7uzgcuoypmdqekrhknnwba", + docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc" ) { name } @@ -224,8 +224,8 @@ func TestQuerySimpleWithUpdateAndMiddleCidAndDocID(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreihyutx64yvxcfeglc2kax3l4kxrp5mae4p7txrxyiszqybs54h3zq", - docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + cid: "bafyreic3z3mjat7i7nm52jwprew7f7dimyob7uzgcuoypmdqekrhknnwba", + docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc" ) { name } @@ -266,8 +266,8 @@ func TestQuerySimpleWithUpdateAndFirstCidAndDocIDAndSchemaVersion(t *testing.T) testUtils.Request{ Request: `query { Users ( - cid: "bafyreifvrmwmlwtglxe3afki36spu6d5qs6vvza57kxs4giyi53r5vbbnu", - docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" + cid: "bafyreicceacb554vtciciumodqmz6vmnfvr6uod2hfhnwujmfqx5pgq3fi", + docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc" ) { name _version { @@ -324,8 +324,8 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithIntKind_NoError(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreifgpewgsde3mpq5upokcngfcehdujokqultxlez3cnskhxfde3dw4", - docID: "bae-a688789e-d8a6-57a7-be09-22e005ab79e0" + cid: "bafyreicsx7flfz4b6iwfmwgrnrnd2klxrbg6yojuffh4ia3lrrqcph5q7a", + docID: "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d" ) { name points @@ -376,8 +376,8 @@ func TestCidAndDocIDQuery_ContainsPNCounterWithFloatKind_NoError(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreic7ds5alv2e7hxdbz3st5tj3vt4rvwydz6sap4wraudl3kzy6y27e", - docID: "bae-fa6a97e9-e0e9-5826-8a8c-57775d35e07c" + cid: "bafyreidwtowbnmdfshq3dptfdggzswtdftyh5374ohfcmqki4ad2wd4m64", + docID: "bae-d420ebcd-023a-5800-ae2e-8ea89442318e" ) { name points @@ -423,8 +423,8 @@ func TestCidAndDocIDQuery_ContainsPCounterWithIntKind_NoError(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreih2vkwfws7vksed465gq736gi5nfxmajlxxemc64nkcendkddtqym", - docID: "bae-a688789e-d8a6-57a7-be09-22e005ab79e0" + cid: "bafyreifngcu76fxe3dtjee556hwymfjgsm3sqhxned4cykit5lcsyy3ope", + docID: "bae-d8cb53d4-ac5a-5c55-8306-64df633d400d" ) { name points @@ -470,8 +470,8 @@ func TestCidAndDocIDQuery_ContainsPCounterWithFloatKind_NoError(t *testing.T) { testUtils.Request{ Request: `query { Users ( - cid: "bafyreihafx27q435dg6mpbfvdsav47oeq65zkeie3eykjbvuhlwtk5ttwm", - docID: "bae-fa6a97e9-e0e9-5826-8a8c-57775d35e07c" + cid: "bafyreigih3wl4ycq5lktczydbecvcvlmdsy5jzarx2l6hcqdcrqkoranny", + docID: "bae-d420ebcd-023a-5800-ae2e-8ea89442318e" ) { name points diff --git a/tests/integration/query/simple/with_deleted_field_test.go b/tests/integration/query/simple/with_deleted_field_test.go index 182cce3280..cc302e29b7 100644 --- a/tests/integration/query/simple/with_deleted_field_test.go +++ b/tests/integration/query/simple/with_deleted_field_test.go @@ -52,11 +52,11 @@ func TestQuerySimple_WithDeletedField(t *testing.T) { Results: []map[string]any{ { "_deleted": true, - "name": "Andy", + "name": "John", }, { "_deleted": true, - "name": "John", + "name": "Andy", }, }, }, diff --git a/tests/integration/query/simple/with_doc_id_filter_test.go b/tests/integration/query/simple/with_doc_id_filter_test.go index 5477665e1c..7c1e886787 100644 --- a/tests/integration/query/simple/with_doc_id_filter_test.go +++ b/tests/integration/query/simple/with_doc_id_filter_test.go @@ -20,7 +20,7 @@ func TestQuerySimpleWithDocIDFilterBlock(t *testing.T) { test := testUtils.RequestTestCase{ Description: "Simple query with basic filter (docID by filter block)", Request: `query { - Users(filter: {_docID: {_eq: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f"}}) { + Users(filter: {_docID: {_eq: "bae-d4303725-7db9-53d2-b324-f3ee44020e52"}}) { Name Age } diff --git a/tests/integration/query/simple/with_doc_id_test.go b/tests/integration/query/simple/with_doc_id_test.go index 6067baea38..7d5e7c0206 100644 --- a/tests/integration/query/simple/with_doc_id_test.go +++ b/tests/integration/query/simple/with_doc_id_test.go @@ -21,7 +21,7 @@ func TestQuerySimpleWithDocIDFilter(t *testing.T) { { Description: "Simple query with basic filter (by docID arg)", Request: `query { - Users(docID: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { + Users(docID: "bae-d4303725-7db9-53d2-b324-f3ee44020e52") { Name Age } @@ -62,7 +62,7 @@ func TestQuerySimpleWithDocIDFilter(t *testing.T) { { Description: "Simple query with basic filter (by docID arg), partial results", Request: `query { - Users(docID: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { + Users(docID: "bae-d4303725-7db9-53d2-b324-f3ee44020e52") { Name Age } diff --git a/tests/integration/query/simple/with_doc_ids_test.go b/tests/integration/query/simple/with_doc_ids_test.go index c28fb5d075..1dc61bb610 100644 --- a/tests/integration/query/simple/with_doc_ids_test.go +++ b/tests/integration/query/simple/with_doc_ids_test.go @@ -21,7 +21,7 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { { Description: "Simple query with basic filter (single ID by docIDs arg)", Request: `query { - Users(docIDs: ["bae-52b9170d-b77a-5887-b877-cbdbb99b009f"]) { + Users(docIDs: ["bae-d4303725-7db9-53d2-b324-f3ee44020e52"]) { Name Age } @@ -62,7 +62,7 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { { Description: "Simple query with basic filter (duplicate ID by docIDs arg), partial results", Request: `query { - Users(docIDs: ["bae-52b9170d-b77a-5887-b877-cbdbb99b009f", "bae-52b9170d-b77a-5887-b877-cbdbb99b009f"]) { + Users(docIDs: ["bae-d4303725-7db9-53d2-b324-f3ee44020e52", "bae-d4303725-7db9-53d2-b324-f3ee44020e52"]) { Name Age } @@ -89,7 +89,7 @@ func TestQuerySimpleWithDocIDsFilter(t *testing.T) { { Description: "Simple query with basic filter (multiple ID by docIDs arg), partial results", Request: `query { - Users(docIDs: ["bae-52b9170d-b77a-5887-b877-cbdbb99b009f", "bae-1378ab62-e064-5af4-9ea6-49941c8d8f94"]) { + Users(docIDs: ["bae-d4303725-7db9-53d2-b324-f3ee44020e52", "bae-428c6d76-3491-520b-ad1f-a218f4dad787"]) { Name Age } diff --git a/tests/integration/query/simple/with_filter/with_and_test.go b/tests/integration/query/simple/with_filter/with_and_test.go index 6ec50be686..bbcbeb38b9 100644 --- a/tests/integration/query/simple/with_filter/with_and_test.go +++ b/tests/integration/query/simple/with_filter/with_and_test.go @@ -46,14 +46,14 @@ func TestQuerySimpleWithIntGreaterThanAndIntLessThanFilter(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(32), - }, { "Name": "John", "Age": int64(21), }, + { + "Name": "Bob", + "Age": int64(32), + }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ge_float_test.go b/tests/integration/query/simple/with_filter/with_ge_float_test.go index f35726bfa2..3983f08718 100644 --- a/tests/integration/query/simple/with_filter/with_ge_float_test.go +++ b/tests/integration/query/simple/with_filter/with_ge_float_test.go @@ -127,10 +127,10 @@ func TestQuerySimpleWithHeightMGEFilterBlockWithNilValue(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", + "Name": "John", }, { - "Name": "John", + "Name": "Bob", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_gt_float_test.go b/tests/integration/query/simple/with_filter/with_gt_float_test.go index c0152b976e..fea3cc968a 100644 --- a/tests/integration/query/simple/with_filter/with_gt_float_test.go +++ b/tests/integration/query/simple/with_filter/with_gt_float_test.go @@ -85,10 +85,10 @@ func TestQuerySimpleWithFloatGreaterThanFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", + "Name": "John", }, { - "Name": "John", + "Name": "Bob", }, }, }, diff --git a/tests/integration/query/simple/with_filter/with_gt_int_test.go b/tests/integration/query/simple/with_filter/with_gt_int_test.go index ecafd44ee4..d832114cac 100644 --- a/tests/integration/query/simple/with_filter/with_gt_int_test.go +++ b/tests/integration/query/simple/with_filter/with_gt_int_test.go @@ -88,14 +88,14 @@ func TestQuerySimpleWithIntGreaterThanFilterBlock(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(32), - }, { "Name": "John", "Age": int64(21), }, + { + "Name": "Bob", + "Age": int64(32), + }, }, }, } diff --git a/tests/integration/query/simple/with_filter/with_in_test.go b/tests/integration/query/simple/with_filter/with_in_test.go index 7e2aa6df82..75867469d9 100644 --- a/tests/integration/query/simple/with_filter/with_in_test.go +++ b/tests/integration/query/simple/with_filter/with_in_test.go @@ -46,14 +46,14 @@ func TestQuerySimpleWithIntInFilter(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Alice", - "Age": int64(19), - }, { "Name": "Carlo", "Age": int64(55), }, + { + "Name": "Alice", + "Age": int64(19), + }, }, } @@ -90,10 +90,10 @@ func TestQuerySimpleWithIntInFilterOnFloat(t *testing.T) { }, Results: []map[string]any{ { - "Name": "John", + "Name": "Carlo", }, { - "Name": "Carlo", + "Name": "John", }, }, } @@ -138,14 +138,14 @@ func TestQuerySimpleWithIntInFilterWithNullValue(t *testing.T) { "Name": "Fred", "Age": nil, }, - { - "Name": "Alice", - "Age": int64(19), - }, { "Name": "Carlo", "Age": int64(55), }, + { + "Name": "Alice", + "Age": int64(19), + }, }, } diff --git a/tests/integration/query/simple/with_filter/with_like_string_test.go b/tests/integration/query/simple/with_filter/with_like_string_test.go index 95ebabc5de..ff6ddf1fa2 100644 --- a/tests/integration/query/simple/with_filter/with_like_string_test.go +++ b/tests/integration/query/simple/with_filter/with_like_string_test.go @@ -278,10 +278,10 @@ func TestQuerySimpleWithLikeStringContainsFilterBlockContainsStringMuplitpleResu }, Results: []map[string]any{ { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + "Name": "Viserys I Targaryen, King of the Andals", }, { - "Name": "Viserys I Targaryen, King of the Andals", + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_bool_test.go b/tests/integration/query/simple/with_filter/with_ne_bool_test.go index b738cefc19..4b68d73592 100644 --- a/tests/integration/query/simple/with_filter/with_ne_bool_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_bool_test.go @@ -77,10 +77,10 @@ func TestQuerySimpleWithBoolNotEqualsNilFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Fred", + "Name": "John", }, { - "Name": "John", + "Name": "Fred", }, }, } @@ -113,10 +113,10 @@ func TestQuerySimpleWithBoolNotEqualsFalseFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", + "Name": "John", }, { - "Name": "John", + "Name": "Bob", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_datetime_test.go b/tests/integration/query/simple/with_filter/with_ne_datetime_test.go index 0179684732..11acb8629c 100644 --- a/tests/integration/query/simple/with_filter/with_ne_datetime_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_datetime_test.go @@ -76,10 +76,10 @@ func TestQuerySimpleWithDateTimeNotEqualsNilFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Name": "John", + "Name": "Bob", }, { - "Name": "Bob", + "Name": "John", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_int_test.go b/tests/integration/query/simple/with_filter/with_ne_int_test.go index 92282990ee..7f61063eed 100644 --- a/tests/integration/query/simple/with_filter/with_ne_int_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_int_test.go @@ -71,10 +71,10 @@ func TestQuerySimpleWithIntNotEqualsNilFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", + "Name": "John", }, { - "Name": "John", + "Name": "Bob", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_ne_string_test.go b/tests/integration/query/simple/with_filter/with_ne_string_test.go index 4142eac647..b052e89e89 100644 --- a/tests/integration/query/simple/with_filter/with_ne_string_test.go +++ b/tests/integration/query/simple/with_filter/with_ne_string_test.go @@ -71,10 +71,10 @@ func TestQuerySimpleWithStringNotEqualsNilFilterBlock(t *testing.T) { }, Results: []map[string]any{ { - "Age": int64(32), + "Age": int64(21), }, { - "Age": int64(21), + "Age": int64(32), }, }, } diff --git a/tests/integration/query/simple/with_filter/with_nin_test.go b/tests/integration/query/simple/with_filter/with_nin_test.go index 77ecf57ddf..9993847c0e 100644 --- a/tests/integration/query/simple/with_filter/with_nin_test.go +++ b/tests/integration/query/simple/with_filter/with_nin_test.go @@ -49,10 +49,10 @@ func TestQuerySimpleWithNotInFilter(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", + "Name": "John", }, { - "Name": "John", + "Name": "Bob", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_nlike_string_test.go b/tests/integration/query/simple/with_filter/with_nlike_string_test.go index a7ca84163d..14526d39e2 100644 --- a/tests/integration/query/simple/with_filter/with_nlike_string_test.go +++ b/tests/integration/query/simple/with_filter/with_nlike_string_test.go @@ -364,10 +364,10 @@ func TestQuerySimpleWithNotLikeStringContainsFilterBlockHasEither(t *testing.T) }, Results: []map[string]any{ { - "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", + "Name": "Viserys I Targaryen, King of the Andals", }, { - "Name": "Viserys I Targaryen, King of the Andals", + "Name": "Daenerys Stormborn of House Targaryen, the First of Her Name", }, }, } diff --git a/tests/integration/query/simple/with_filter/with_not_test.go b/tests/integration/query/simple/with_filter/with_not_test.go index 2ce454a358..14fef0d155 100644 --- a/tests/integration/query/simple/with_filter/with_not_test.go +++ b/tests/integration/query/simple/with_filter/with_not_test.go @@ -46,6 +46,10 @@ func TestQuerySimple_WithNotEqualToXFilter_NoError(t *testing.T) { }, }, Results: []map[string]any{ + { + "Name": "John", + "Age": int64(21), + }, { "Name": "Bob", "Age": int64(32), @@ -54,10 +58,6 @@ func TestQuerySimple_WithNotEqualToXFilter_NoError(t *testing.T) { "Name": "Alice", "Age": int64(19), }, - { - "Name": "John", - "Age": int64(21), - }, }, } @@ -134,14 +134,14 @@ func TestQuerySimple_WithNotEqualToXorYFilter_NoError(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(32), - }, { "Name": "John", "Age": int64(21), }, + { + "Name": "Bob", + "Age": int64(32), + }, }, } @@ -217,22 +217,22 @@ func TestQuerySimple_WithNotEqualToXAndNotYFilter_NoError(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Bob", - "Age": int64(32), - }, - { - "Name": "Alice", - "Age": int64(19), - }, { "Name": "John", "Age": int64(21), }, + { + "Name": "Bob", + "Age": int64(32), + }, { "Name": "Carlo", "Age": int64(55), }, + { + "Name": "Alice", + "Age": int64(19), + }, }, } diff --git a/tests/integration/query/simple/with_filter/with_or_test.go b/tests/integration/query/simple/with_filter/with_or_test.go index 1ff1f91ce6..2c1ea68e94 100644 --- a/tests/integration/query/simple/with_filter/with_or_test.go +++ b/tests/integration/query/simple/with_filter/with_or_test.go @@ -46,14 +46,14 @@ func TestQuerySimpleWithIntEqualToXOrYFilter(t *testing.T) { }, }, Results: []map[string]any{ - { - "Name": "Alice", - "Age": int64(19), - }, { "Name": "Carlo", "Age": int64(55), }, + { + "Name": "Alice", + "Age": int64(19), + }, }, } diff --git a/tests/integration/query/simple/with_group_average_filter_test.go b/tests/integration/query/simple/with_group_average_filter_test.go index fe33e9f4ef..fa68f2d0e9 100644 --- a/tests/integration/query/simple/with_group_average_filter_test.go +++ b/tests/integration/query/simple/with_group_average_filter_test.go @@ -42,14 +42,14 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAverageWithFilt }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_avg": float64(0), - }, { "Name": "John", "_avg": float64(33), }, + { + "Name": "Alice", + "_avg": float64(0), + }, }, } @@ -86,23 +86,23 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupAndChildAverageWithFilter( }, Results: []map[string]any{ { - "Name": "Alice", - "_avg": float64(0), + "Name": "John", + "_avg": float64(33), "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(34), + }, + { + "Age": int64(32), }, }, }, { - "Name": "John", - "_avg": float64(33), + "Name": "Alice", + "_avg": float64(0), "_group": []map[string]any{ { - "Age": int64(32), - }, - { - "Age": int64(34), + "Age": int64(19), }, }, }, @@ -200,11 +200,6 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_avg": float64(0), - "_group": []map[string]any{}, - }, { "Name": "John", "_avg": float64(34), @@ -214,6 +209,11 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }, }, }, + { + "Name": "Alice", + "_avg": float64(0), + "_group": []map[string]any{}, + }, }, } @@ -302,20 +302,20 @@ func TestQuerySimpleWithGroupByStringWithRenderedGroupWithFilterAndChildAverageW }, Results: []map[string]any{ { - "Name": "Alice", - "_avg": float64(0), + "Name": "John", + "_avg": float64(34), "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(32), }, }, }, { - "Name": "John", - "_avg": float64(34), + "Name": "Alice", + "_avg": float64(0), "_group": []map[string]any{ { - "Age": int64(32), + "Age": int64(19), }, }, }, @@ -352,16 +352,16 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAveragesWithDif }, }, Results: []map[string]any{ - { - "Name": "Alice", - "A1": float64(0), - "A2": float64(19), - }, { "Name": "John", "A1": float64(33), "A2": float64(0), }, + { + "Name": "Alice", + "A1": float64(0), + "A2": float64(19), + }, }, } @@ -402,14 +402,14 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildAverageWithFilt }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_avg": float64(19), - }, { "Name": "John", "_avg": float64(31), }, + { + "Name": "Alice", + "_avg": float64(19), + }, }, } diff --git a/tests/integration/query/simple/with_group_average_sum_test.go b/tests/integration/query/simple/with_group_average_sum_test.go index 04cc852bea..4a1851df67 100644 --- a/tests/integration/query/simple/with_group_average_sum_test.go +++ b/tests/integration/query/simple/with_group_average_sum_test.go @@ -74,22 +74,22 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCountOfInt(t * }, }, { - "Name": "Alice", - "_sum": float64(19), + "Name": "Carlo", + "_sum": float64(55), "_group": []map[string]any{ { - "Verified": false, - "_avg": float64(19), + "Verified": true, + "_avg": float64(55), }, }, }, { - "Name": "Carlo", - "_sum": float64(55), + "Name": "Alice", + "_sum": float64(19), "_group": []map[string]any{ { - "Verified": true, - "_avg": float64(55), + "Verified": false, + "_avg": float64(19), }, }, }, diff --git a/tests/integration/query/simple/with_group_average_test.go b/tests/integration/query/simple/with_group_average_test.go index cebf392c26..91aacd3c8a 100644 --- a/tests/integration/query/simple/with_group_average_test.go +++ b/tests/integration/query/simple/with_group_average_test.go @@ -121,14 +121,14 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildNilAverage(t *t }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_avg": float64(19), - }, { "Name": "John", "_avg": float64(32), }, + { + "Name": "Alice", + "_avg": float64(19), + }, }, } @@ -193,22 +193,22 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfI }, }, { - "Name": "Alice", - "_avg": float64(19), + "Name": "Carlo", + "_avg": float64(55), "_group": []map[string]any{ { - "Verified": false, - "_avg": float64(19), + "Verified": true, + "_avg": float64(55), }, }, }, { - "Name": "Carlo", - "_avg": float64(55), + "Name": "Alice", + "_avg": float64(19), "_group": []map[string]any{ { - "Verified": true, - "_avg": float64(55), + "Verified": false, + "_avg": float64(19), }, }, }, @@ -341,26 +341,26 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfF }, Results: []map[string]any{ { - "Name": "John", - "_avg": float64(1.9675000000000002), + "Name": "Alice", + "_avg": float64(2.04), "_group": []map[string]any{ { "Verified": false, - "_avg": float64(2.22), - }, - { - "Verified": true, - "_avg": float64(1.715), + "_avg": float64(2.04), }, }, }, { - "Name": "Alice", - "_avg": float64(2.04), + "Name": "John", + "_avg": float64(1.9675000000000002), "_group": []map[string]any{ + { + "Verified": true, + "_avg": float64(1.715), + }, { "Verified": false, - "_avg": float64(2.04), + "_avg": float64(2.22), }, }, }, @@ -433,30 +433,16 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfA }, Results: []map[string]any{ { - "Name": "John", - "_avg": float64(1.9675000000000002), + "Name": "Carlo", + "_avg": float64(1.74), "_group": []map[string]any{ - { - "Verified": false, - "_avg": float64(2.22), - "_group": []map[string]any{ - { - "Age": int64(34), - "_avg": float64(2.22), - }, - }, - }, { "Verified": true, - "_avg": float64(1.715), + "_avg": float64(1.74), "_group": []map[string]any{ { - "Age": int64(32), - "_avg": float64(1.61), - }, - { - "Age": int64(25), - "_avg": float64(1.82), + "Age": int64(55), + "_avg": float64(1.74), }, }, }, @@ -479,16 +465,30 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndAverageOfAverageOfA }, }, { - "Name": "Carlo", - "_avg": float64(1.74), + "Name": "John", + "_avg": float64(1.9675000000000002), "_group": []map[string]any{ { "Verified": true, - "_avg": float64(1.74), + "_avg": float64(1.715), "_group": []map[string]any{ { - "Age": int64(55), - "_avg": float64(1.74), + "Age": int64(32), + "_avg": float64(1.61), + }, + { + "Age": int64(25), + "_avg": float64(1.82), + }, + }, + }, + { + "Verified": false, + "_avg": float64(2.22), + "_group": []map[string]any{ + { + "Age": int64(34), + "_avg": float64(2.22), }, }, }, diff --git a/tests/integration/query/simple/with_group_count_limit_offset_test.go b/tests/integration/query/simple/with_group_count_limit_offset_test.go index 45fe4bf90a..015f76c30c 100644 --- a/tests/integration/query/simple/with_group_count_limit_offset_test.go +++ b/tests/integration/query/simple/with_group_count_limit_offset_test.go @@ -97,7 +97,7 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithLimitAndChildCountWith "Name": "Bob", }, { - "Name": "John", + "Name": "Shahzad", }, }, }, diff --git a/tests/integration/query/simple/with_group_count_limit_test.go b/tests/integration/query/simple/with_group_count_limit_test.go index 9476c99bc9..1870e07bc2 100644 --- a/tests/integration/query/simple/with_group_count_limit_test.go +++ b/tests/integration/query/simple/with_group_count_limit_test.go @@ -97,7 +97,7 @@ func TestQuerySimpleWithGroupByNumberWithRenderedGroupWithLimitAndChildCountWith "Name": "Bob", }, { - "Name": "John", + "Name": "Shahzad", }, }, }, diff --git a/tests/integration/query/simple/with_group_count_sum_test.go b/tests/integration/query/simple/with_group_count_sum_test.go index 21ac55a6dd..aab55c4002 100644 --- a/tests/integration/query/simple/with_group_count_sum_test.go +++ b/tests/integration/query/simple/with_group_count_sum_test.go @@ -74,21 +74,21 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfCount(t *testi }, }, { - "Name": "Alice", + "Name": "Carlo", "_sum": int64(1), "_group": []map[string]any{ { - "Verified": false, + "Verified": true, "_count": int(1), }, }, }, { - "Name": "Carlo", + "Name": "Alice", "_sum": int64(1), "_group": []map[string]any{ { - "Verified": true, + "Verified": false, "_count": int(1), }, }, diff --git a/tests/integration/query/simple/with_group_doc_id_test.go b/tests/integration/query/simple/with_group_doc_id_test.go index 177934ebdc..f476b3c617 100644 --- a/tests/integration/query/simple/with_group_doc_id_test.go +++ b/tests/integration/query/simple/with_group_doc_id_test.go @@ -22,14 +22,14 @@ func TestQuerySimpleWithGroupByWithGroupWithDocID(t *testing.T) { Request: `query { Users(groupBy: [Age]) { Age - _group(docID: "bae-52b9170d-b77a-5887-b877-cbdbb99b009f") { + _group(docID: "bae-d4303725-7db9-53d2-b324-f3ee44020e52") { Name } } }`, Docs: map[int][]string{ 0: { - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 `{ "Name": "John", "Age": 21 @@ -45,10 +45,6 @@ func TestQuerySimpleWithGroupByWithGroupWithDocID(t *testing.T) { }, }, Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{}, - }, { "Age": int64(21), "_group": []map[string]any{ @@ -57,6 +53,10 @@ func TestQuerySimpleWithGroupByWithGroupWithDocID(t *testing.T) { }, }, }, + { + "Age": int64(32), + "_group": []map[string]any{}, + }, }, } diff --git a/tests/integration/query/simple/with_group_doc_ids_test.go b/tests/integration/query/simple/with_group_doc_ids_test.go index 9db3bae934..72aa527b66 100644 --- a/tests/integration/query/simple/with_group_doc_ids_test.go +++ b/tests/integration/query/simple/with_group_doc_ids_test.go @@ -22,14 +22,14 @@ func TestQuerySimpleWithGroupByWithGroupWithDocIDs(t *testing.T) { Request: `query { Users(groupBy: [Age]) { Age - _group(docIDs: ["bae-52b9170d-b77a-5887-b877-cbdbb99b009f", "bae-9b2e1434-9d61-5eb1-b3b9-82e8e40729a7"]) { + _group(docIDs: ["bae-d4303725-7db9-53d2-b324-f3ee44020e52", "bae-19b16890-5f24-5e5b-8822-ed2a97ebcc24"]) { Name } } }`, Docs: map[int][]string{ 0: { - // bae-52b9170d-b77a-5887-b877-cbdbb99b009f + // bae-d4303725-7db9-53d2-b324-f3ee44020e52 `{ "Name": "John", "Age": 21 @@ -38,7 +38,7 @@ func TestQuerySimpleWithGroupByWithGroupWithDocIDs(t *testing.T) { "Name": "Bob", "Age": 32 }`, - // bae-9b2e1434-9d61-5eb1-b3b9-82e8e40729a7 + // bae-19b16890-5f24-5e5b-8822-ed2a97ebcc24 `{ "Name": "Fred", "Age": 21 @@ -50,21 +50,21 @@ func TestQuerySimpleWithGroupByWithGroupWithDocIDs(t *testing.T) { }, }, Results: []map[string]any{ - { - "Age": int64(32), - "_group": []map[string]any{}, - }, { "Age": int64(21), "_group": []map[string]any{ { - "Name": "John", + "Name": "Fred", }, { - "Name": "Fred", + "Name": "John", }, }, }, + { + "Age": int64(32), + "_group": []map[string]any{}, + }, }, } diff --git a/tests/integration/query/simple/with_group_filter_test.go b/tests/integration/query/simple/with_group_filter_test.go index 36e09fa69f..919d4c311b 100644 --- a/tests/integration/query/simple/with_group_filter_test.go +++ b/tests/integration/query/simple/with_group_filter_test.go @@ -49,25 +49,25 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberFilter(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Alice", - "_group": []map[string]any{}, - }, - { - "Name": "John", + "Name": "Carlo", "_group": []map[string]any{ { - "Age": int64(32), + "Age": int64(55), }, }, }, { - "Name": "Carlo", + "Name": "John", "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(32), }, }, }, + { + "Name": "Alice", + "_group": []map[string]any{}, + }, }, } @@ -107,18 +107,18 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithParentFilter(t *testing. }, Results: []map[string]any{ { - "Name": "John", + "Name": "Carlo", "_group": []map[string]any{ { - "Age": int64(32), + "Age": int64(55), }, }, }, { - "Name": "Carlo", + "Name": "John", "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(32), }, }, }, @@ -158,10 +158,10 @@ func TestQuerySimpleWithGroupByStringWithUnrenderedGroupNumberWithParentFilter(t }, Results: []map[string]any{ { - "Name": "John", + "Name": "Carlo", }, { - "Name": "Carlo", + "Name": "John", }, }, } @@ -229,19 +229,19 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanThenInnerNumberFilterT }, }, { - "Name": "Alice", + "Name": "Carlo", "_group": []map[string]any{ { - "Verified": false, + "Verified": true, "_group": []map[string]any{}, }, }, }, { - "Name": "Carlo", + "Name": "Alice", "_group": []map[string]any{ { - "Verified": true, + "Verified": false, "_group": []map[string]any{}, }, }, @@ -288,13 +288,13 @@ func TestQuerySimpleWithGroupByStringWithMultipleGroupNumberFilter(t *testing.T) }, Results: []map[string]any{ { - "Name": "Alice", - "G1": []map[string]any{}, - "G2": []map[string]any{ + "Name": "Carlo", + "G1": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, + "G2": []map[string]any{}, }, { "Name": "John", @@ -310,13 +310,13 @@ func TestQuerySimpleWithGroupByStringWithMultipleGroupNumberFilter(t *testing.T) }, }, { - "Name": "Carlo", - "G1": []map[string]any{ + "Name": "Alice", + "G1": []map[string]any{}, + "G2": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, - "G2": []map[string]any{}, }, }, } diff --git a/tests/integration/query/simple/with_group_order_test.go b/tests/integration/query/simple/with_group_order_test.go index ffe52ca7c1..29d7014b03 100644 --- a/tests/integration/query/simple/with_group_order_test.go +++ b/tests/integration/query/simple/with_group_order_test.go @@ -48,6 +48,14 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrder(t *testing.T) }, }, Results: []map[string]any{ + { + "Name": "Carlo", + "_group": []map[string]any{ + { + "Age": int64(55), + }, + }, + }, { "Name": "Alice", "_group": []map[string]any{ @@ -67,14 +75,6 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrder(t *testing.T) }, }, }, - { - "Name": "Carlo", - "_group": []map[string]any{ - { - "Age": int64(55), - }, - }, - }, }, } @@ -113,14 +113,6 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrderDescending(t * }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_group": []map[string]any{ - { - "Age": int64(19), - }, - }, - }, { "Name": "Carlo", "_group": []map[string]any{ @@ -140,6 +132,14 @@ func TestQuerySimpleWithGroupByStringWithGroupNumberWithGroupOrderDescending(t * }, }, }, + { + "Name": "Alice", + "_group": []map[string]any{ + { + "Age": int64(19), + }, + }, + }, }, } diff --git a/tests/integration/query/simple/with_group_sum_test.go b/tests/integration/query/simple/with_group_sum_test.go index 9391ef7d5f..8fd0ce6fb1 100644 --- a/tests/integration/query/simple/with_group_sum_test.go +++ b/tests/integration/query/simple/with_group_sum_test.go @@ -121,14 +121,14 @@ func TestQuerySimpleWithGroupByStringWithoutRenderedGroupAndChildNilSum(t *testi }, }, Results: []map[string]any{ - { - "Name": "Alice", - "_sum": int64(19), - }, { "Name": "John", "_sum": int64(32), }, + { + "Name": "Alice", + "_sum": int64(19), + }, }, } @@ -193,22 +193,22 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfInt(t *te }, }, { - "Name": "Alice", - "_sum": int64(19), + "Name": "Carlo", + "_sum": int64(55), "_group": []map[string]any{ { - "Verified": false, - "_sum": int64(19), + "Verified": true, + "_sum": int64(55), }, }, }, { - "Name": "Carlo", - "_sum": int64(55), + "Name": "Alice", + "_sum": int64(19), "_group": []map[string]any{ { - "Verified": true, - "_sum": int64(55), + "Verified": false, + "_sum": int64(19), }, }, }, @@ -341,26 +341,26 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfFloat(t * }, Results: []map[string]any{ { - "Name": "John", - "_sum": float64(5.65), + "Name": "Alice", + "_sum": float64(2.04), "_group": []map[string]any{ { "Verified": false, - "_sum": float64(2.22), - }, - { - "Verified": true, - "_sum": float64(3.43), + "_sum": float64(2.04), }, }, }, { - "Name": "Alice", - "_sum": float64(2.04), + "Name": "John", + "_sum": float64(5.65), "_group": []map[string]any{ + { + "Verified": true, + "_sum": float64(3.43), + }, { "Verified": false, - "_sum": float64(2.04), + "_sum": float64(2.22), }, }, }, @@ -433,30 +433,16 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfSumOfFloa }, Results: []map[string]any{ { - "Name": "John", - "_sum": float64(5.65), + "Name": "Carlo", + "_sum": float64(1.74), "_group": []map[string]any{ - { - "Verified": false, - "_sum": float64(2.22), - "_group": []map[string]any{ - { - "Age": int64(34), - "_sum": float64(2.22), - }, - }, - }, { "Verified": true, - "_sum": float64(3.43), + "_sum": float64(1.74), "_group": []map[string]any{ { - "Age": int64(32), - "_sum": float64(1.61), - }, - { - "Age": int64(25), - "_sum": float64(1.82), + "Age": int64(55), + "_sum": float64(1.74), }, }, }, @@ -479,16 +465,30 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBooleanAndSumOfSumOfSumOfFloa }, }, { - "Name": "Carlo", - "_sum": float64(1.74), + "Name": "John", + "_sum": float64(5.65), "_group": []map[string]any{ { "Verified": true, - "_sum": float64(1.74), + "_sum": float64(3.43), "_group": []map[string]any{ { - "Age": int64(55), - "_sum": float64(1.74), + "Age": int64(32), + "_sum": float64(1.61), + }, + { + "Age": int64(25), + "_sum": float64(1.82), + }, + }, + }, + { + "Verified": false, + "_sum": float64(2.22), + "_group": []map[string]any{ + { + "Age": int64(34), + "_sum": float64(2.22), }, }, }, diff --git a/tests/integration/query/simple/with_group_test.go b/tests/integration/query/simple/with_group_test.go index e740787d3c..a12ecd0668 100644 --- a/tests/integration/query/simple/with_group_test.go +++ b/tests/integration/query/simple/with_group_test.go @@ -85,13 +85,13 @@ func TestQuerySimpleWithGroupByNumber(t *testing.T) { }, Results: []map[string]any{ { - "Age": int64(32), + "Age": int64(55), }, { - "Age": int64(19), + "Age": int64(32), }, { - "Age": int64(55), + "Age": int64(19), }, }, } @@ -129,13 +129,13 @@ func TestQuerySimpleWithGroupByDateTime(t *testing.T) { }, Results: []map[string]any{ { - "CreatedAt": testUtils.MustParseTime("2013-07-23T03:46:56-05:00"), + "CreatedAt": testUtils.MustParseTime("2011-07-23T03:46:56-05:00"), }, { - "CreatedAt": testUtils.MustParseTime("2012-07-23T03:46:56-05:00"), + "CreatedAt": testUtils.MustParseTime("2013-07-23T03:46:56-05:00"), }, { - "CreatedAt": testUtils.MustParseTime("2011-07-23T03:46:56-05:00"), + "CreatedAt": testUtils.MustParseTime("2012-07-23T03:46:56-05:00"), }, }, } @@ -175,6 +175,14 @@ func TestQuerySimpleWithGroupByNumberWithGroupString(t *testing.T) { }, }, Results: []map[string]any{ + { + "Age": int64(55), + "_group": []map[string]any{ + { + "Name": "Carlo", + }, + }, + }, { "Age": int64(32), "_group": []map[string]any{ @@ -194,14 +202,6 @@ func TestQuerySimpleWithGroupByNumberWithGroupString(t *testing.T) { }, }, }, - { - "Age": int64(55), - "_group": []map[string]any{ - { - "Name": "Carlo", - }, - }, - }, }, } @@ -241,10 +241,10 @@ func TestQuerySimpleWithGroupByWithoutGroupedFieldSelectedWithInnerGroup(t *test }, Results: []map[string]any{ { - "Name": "Alice", + "Name": "Carlo", "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, }, @@ -252,18 +252,18 @@ func TestQuerySimpleWithGroupByWithoutGroupedFieldSelectedWithInnerGroup(t *test "Name": "John", "_group": []map[string]any{ { - "Age": int64(32), + "Age": int64(25), }, { - "Age": int64(25), + "Age": int64(32), }, }, }, { - "Name": "Carlo", + "Name": "Alice", "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, }, @@ -306,10 +306,10 @@ func TestQuerySimpleWithGroupByString(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Alice", + "Name": "Carlo", "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, }, @@ -317,18 +317,18 @@ func TestQuerySimpleWithGroupByString(t *testing.T) { "Name": "John", "_group": []map[string]any{ { - "Age": int64(32), + "Age": int64(25), }, { - "Age": int64(25), + "Age": int64(32), }, }, }, { - "Name": "Carlo", + "Name": "Alice", "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, }, @@ -407,26 +407,26 @@ func TestQuerySimpleWithGroupByStringWithInnerGroupBoolean(t *testing.T) { }, }, { - "Name": "Alice", + "Name": "Carlo", "_group": []map[string]any{ { - "Verified": false, + "Verified": true, "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, }, }, }, { - "Name": "Carlo", + "Name": "Alice", "_group": []map[string]any{ { - "Verified": true, + "Verified": false, "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, }, @@ -502,20 +502,20 @@ func TestQuerySimpleWithGroupByStringThenBoolean(t *testing.T) { }, }, { - "Name": "Alice", - "Verified": false, + "Name": "Carlo", + "Verified": true, "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, }, { - "Name": "Carlo", - "Verified": true, + "Name": "Alice", + "Verified": false, "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, }, @@ -589,20 +589,20 @@ func TestQuerySimpleWithGroupByBooleanThenNumber(t *testing.T) { }, }, { - "Name": "Alice", - "Verified": false, + "Name": "Carlo", + "Verified": true, "_group": []map[string]any{ { - "Age": int64(19), + "Age": int64(55), }, }, }, { - "Name": "Carlo", - "Verified": true, + "Name": "Alice", + "Verified": false, "_group": []map[string]any{ { - "Age": int64(55), + "Age": int64(19), }, }, }, @@ -677,10 +677,10 @@ func TestQuerySimpleWithGroupByNumberOnUndefinedWithChildren(t *testing.T) { "Age": nil, "_group": []map[string]any{ { - "Name": "Bob", + "Name": "Alice", }, { - "Name": "Alice", + "Name": "Bob", }, }, }, diff --git a/tests/integration/query/simple/with_limit_offset_test.go b/tests/integration/query/simple/with_limit_offset_test.go index 13683414c7..21e02f049c 100644 --- a/tests/integration/query/simple/with_limit_offset_test.go +++ b/tests/integration/query/simple/with_limit_offset_test.go @@ -108,12 +108,12 @@ func TestQuerySimpleWithLimit(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Bob", - "Age": int64(32), + "Name": "Carlo", + "Age": int64(55), }, { - "Name": "Alice", - "Age": int64(19), + "Name": "Bob", + "Age": int64(32), }, }, }, @@ -187,8 +187,8 @@ func TestQuerySimpleWithLimitAndOffset(t *testing.T) { "Age": int64(21), }, { - "Name": "Carlo", - "Age": int64(55), + "Name": "Alice", + "Age": int64(19), }, }, }, @@ -262,16 +262,16 @@ func TestQuerySimpleWithOffset(t *testing.T) { }, Results: []map[string]any{ { - "Name": "Alice", - "Age": int64(19), + "Name": "Melynda", + "Age": int64(30), }, { "Name": "John", "Age": int64(21), }, { - "Name": "Carlo", - "Age": int64(55), + "Name": "Alice", + "Age": int64(19), }, }, }, diff --git a/tests/integration/query/simple/with_order_test.go b/tests/integration/query/simple/with_order_test.go index 1a1f966e60..1bd56574f9 100644 --- a/tests/integration/query/simple/with_order_test.go +++ b/tests/integration/query/simple/with_order_test.go @@ -42,6 +42,10 @@ func TestQuerySimpleWithEmptyOrder(t *testing.T) { }, }, Results: []map[string]any{ + { + "Name": "Carlo", + "Age": int64(55), + }, { "Name": "Bob", "Age": int64(32), @@ -50,10 +54,6 @@ func TestQuerySimpleWithEmptyOrder(t *testing.T) { "Name": "John", "Age": int64(21), }, - { - "Name": "Carlo", - "Age": int64(55), - }, }, } diff --git a/tests/integration/query/simple/with_version_test.go b/tests/integration/query/simple/with_version_test.go index ea7ac76a2b..67edabea9d 100644 --- a/tests/integration/query/simple/with_version_test.go +++ b/tests/integration/query/simple/with_version_test.go @@ -46,15 +46,15 @@ func TestQuerySimpleWithEmbeddedLatestCommit(t *testing.T) { "Age": int64(21), "_version": []map[string]any{ { - "cid": "bafyreidmbagmnhwb3qr5qctclsylkzgrwpbmiuxirtfbdf3fuzxbibljfi", + "cid": "bafyreiamhlxewin3mgbr6dh3mrbwzvjfngfbwif2qdpjvaldzciivojaiu", "links": []map[string]any{ { - "cid": "bafyreibhdfmodhqycxtw33ffdceh2wlxqlwcwbyowvs2lrlvimph7ekg2u", - "name": "Name", + "cid": "bafyreibmearhvd62tofeoxhhodzwkz446ehjybll22fyb4tgmnvx2kwfma", + "name": "Age", }, { - "cid": "bafyreigrxupxvzvjfx6wblmpc6fgekapr7nxlmokvi4gmz6ojmzmbrnapa", - "name": "Age", + "cid": "bafyreid45hs4k3kxxl5t6glfn5ohd6pebjbdhyvtrjmino6g3l2dqdzwiq", + "name": "Name", }, }, }, @@ -101,7 +101,7 @@ func TestQuerySimpleWithEmbeddedLatestCommitWithSchemaVersionID(t *testing.T) { } func TestQuerySimpleWithEmbeddedLatestCommitWithDocID(t *testing.T) { - const docID = "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" + const docID = "bae-d4303725-7db9-53d2-b324-f3ee44020e52" test := testUtils.RequestTestCase{ Description: "Embedded commits query within object query with document ID", @@ -171,23 +171,23 @@ func TestQuerySimpleWithMultipleAliasedEmbeddedLatestCommit(t *testing.T) { "Age": int64(21), "_version": []map[string]any{ { - "cid": "bafyreidmbagmnhwb3qr5qctclsylkzgrwpbmiuxirtfbdf3fuzxbibljfi", + "cid": "bafyreiamhlxewin3mgbr6dh3mrbwzvjfngfbwif2qdpjvaldzciivojaiu", "L1": []map[string]any{ { - "cid": "bafyreibhdfmodhqycxtw33ffdceh2wlxqlwcwbyowvs2lrlvimph7ekg2u", - "name": "Name", + "cid": "bafyreibmearhvd62tofeoxhhodzwkz446ehjybll22fyb4tgmnvx2kwfma", + "name": "Age", }, { - "cid": "bafyreigrxupxvzvjfx6wblmpc6fgekapr7nxlmokvi4gmz6ojmzmbrnapa", - "name": "Age", + "cid": "bafyreid45hs4k3kxxl5t6glfn5ohd6pebjbdhyvtrjmino6g3l2dqdzwiq", + "name": "Name", }, }, "L2": []map[string]any{ { - "name": "Name", + "name": "Age", }, { - "name": "Age", + "name": "Name", }, }, }, @@ -200,7 +200,7 @@ func TestQuerySimpleWithMultipleAliasedEmbeddedLatestCommit(t *testing.T) { } func TestQuery_WithAllCommitFields_NoError(t *testing.T) { - const docID = "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" + const docID = "bae-d4303725-7db9-53d2-b324-f3ee44020e52" test := testUtils.TestCase{ Description: "Embedded commits query within object query with document ID", @@ -242,21 +242,21 @@ func TestQuery_WithAllCommitFields_NoError(t *testing.T) { "_docID": docID, "_version": []map[string]any{ { - "cid": "bafyreidmbagmnhwb3qr5qctclsylkzgrwpbmiuxirtfbdf3fuzxbibljfi", + "cid": "bafyreiamhlxewin3mgbr6dh3mrbwzvjfngfbwif2qdpjvaldzciivojaiu", "collectionID": int64(1), "delta": nil, - "docID": "bae-52b9170d-b77a-5887-b877-cbdbb99b009f", + "docID": "bae-d4303725-7db9-53d2-b324-f3ee44020e52", "fieldId": "C", "fieldName": nil, "height": int64(1), "links": []map[string]any{ { - "cid": "bafyreibhdfmodhqycxtw33ffdceh2wlxqlwcwbyowvs2lrlvimph7ekg2u", - "name": "Name", + "cid": "bafyreibmearhvd62tofeoxhhodzwkz446ehjybll22fyb4tgmnvx2kwfma", + "name": "Age", }, { - "cid": "bafyreigrxupxvzvjfx6wblmpc6fgekapr7nxlmokvi4gmz6ojmzmbrnapa", - "name": "Age", + "cid": "bafyreid45hs4k3kxxl5t6glfn5ohd6pebjbdhyvtrjmino6g3l2dqdzwiq", + "name": "Name", }, }, "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", @@ -272,7 +272,7 @@ func TestQuery_WithAllCommitFields_NoError(t *testing.T) { } func TestQuery_WithAllCommitFieldsWithUpdate_NoError(t *testing.T) { - const docID = "bae-52b9170d-b77a-5887-b877-cbdbb99b009f" + const docID = "bae-d4303725-7db9-53d2-b324-f3ee44020e52" test := testUtils.TestCase{ Description: "Embedded commits query within object query with document ID", @@ -321,41 +321,41 @@ func TestQuery_WithAllCommitFieldsWithUpdate_NoError(t *testing.T) { "_docID": docID, "_version": []map[string]any{ { - "cid": "bafyreibbn2vjovh65xe5v2bqxqxkb6sek5xkbnouhryya6enesbhzfplvm", + "cid": "bafyreiewiyarxxkzmgss6g35i4h2uiyzoe6kbnmtwaxv4cab6xefnjlzka", "collectionID": int64(1), "delta": nil, - "docID": "bae-52b9170d-b77a-5887-b877-cbdbb99b009f", + "docID": docID, "fieldId": "C", "fieldName": nil, "height": int64(2), "links": []map[string]any{ { - "cid": "bafyreidmbagmnhwb3qr5qctclsylkzgrwpbmiuxirtfbdf3fuzxbibljfi", + "cid": "bafyreiamhlxewin3mgbr6dh3mrbwzvjfngfbwif2qdpjvaldzciivojaiu", "name": "_head", }, { - "cid": "bafyreifycx5aqjhdlmzaf3bqb6ieomfxrzercas3hxnqcwz2jb25mkrzxi", + "cid": "bafyreiejccdc662jvyhia2ee57dvuuzsrsrhbx3hoenojtasofxtix3k7y", "name": "Age", }, }, "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", }, { - "cid": "bafyreidmbagmnhwb3qr5qctclsylkzgrwpbmiuxirtfbdf3fuzxbibljfi", + "cid": "bafyreiamhlxewin3mgbr6dh3mrbwzvjfngfbwif2qdpjvaldzciivojaiu", "collectionID": int64(1), "delta": nil, - "docID": "bae-52b9170d-b77a-5887-b877-cbdbb99b009f", + "docID": docID, "fieldId": "C", "fieldName": nil, "height": int64(1), "links": []map[string]any{ { - "cid": "bafyreibhdfmodhqycxtw33ffdceh2wlxqlwcwbyowvs2lrlvimph7ekg2u", - "name": "Name", + "cid": "bafyreibmearhvd62tofeoxhhodzwkz446ehjybll22fyb4tgmnvx2kwfma", + "name": "Age", }, { - "cid": "bafyreigrxupxvzvjfx6wblmpc6fgekapr7nxlmokvi4gmz6ojmzmbrnapa", - "name": "Age", + "cid": "bafyreid45hs4k3kxxl5t6glfn5ohd6pebjbdhyvtrjmino6g3l2dqdzwiq", + "name": "Name", }, }, "schemaVersionId": "bafkreigqmcqzkbg3elpe24vfza4rjle2r6cxu7ihzvg56aov57crhaebry", diff --git a/tests/integration/schema/migrations/query/with_doc_id_test.go b/tests/integration/schema/migrations/query/with_doc_id_test.go index ee175515dc..a006441c4f 100644 --- a/tests/integration/schema/migrations/query/with_doc_id_test.go +++ b/tests/integration/schema/migrations/query/with_doc_id_test.go @@ -33,7 +33,7 @@ func TestSchemaMigrationQueryByDocID(t *testing.T) { `, }, testUtils.CreateDoc{ - // bae-d7546ac1-c133-5853-b866-9b9f926fe7e5 + // bae-48c8dacd-58ab-5fd5-8bbf-91bd823f4d5e Doc: `{ "name": "Shahzad" }`, @@ -69,7 +69,7 @@ func TestSchemaMigrationQueryByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5") { + Users (docID: "bae-48c8dacd-58ab-5fd5-8bbf-91bd823f4d5e") { name verified } @@ -114,37 +114,37 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { // and we want to make sure that lenses are being correctly returned // to the pool for reuse after. testUtils.CreateDoc{ - // bae-d7546ac1-c133-5853-b866-9b9f926fe7e5 + // bae-48c8dacd-58ab-5fd5-8bbf-91bd823f4d5e Doc: `{ "name": "Shahzad" }`, }, testUtils.CreateDoc{ - // bae-92393ad0-07b6-5753-8dbb-19c9c41374ed + // bae-3a7df128-bfa9-559a-a9c5-96f2bf6d1038 Doc: `{ "name": "Fred" }`, }, testUtils.CreateDoc{ - // bae-403d7337-f73e-5c81-8719-e853938c8985 + // bae-5622129c-b893-5768-a3f4-8f745db4cc04 Doc: `{ "name": "Chris" }`, }, testUtils.CreateDoc{ - // bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad + // bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc Doc: `{ "name": "John" }`, }, testUtils.CreateDoc{ - // bae-3f1174ba-d9bc-5a6a-b0bc-8f19581f199d + // bae-38a4ebb2-583a-5b6e-8e90-a6fe9e13be06 Doc: `{ "name": "Islam" }`, }, testUtils.CreateDoc{ - // bae-0698bda7-2c69-5028-a26a-0a1c491b793b + // bae-4d2c0f6e-af73-54d9-ac8a-a419077ea1e5 Doc: `{ "name": "Dave" }`, @@ -175,7 +175,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-d7546ac1-c133-5853-b866-9b9f926fe7e5") { + Users (docID: "bae-48c8dacd-58ab-5fd5-8bbf-91bd823f4d5e") { name verified } @@ -189,7 +189,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-92393ad0-07b6-5753-8dbb-19c9c41374ed") { + Users (docID: "bae-3a7df128-bfa9-559a-a9c5-96f2bf6d1038") { name verified } @@ -203,7 +203,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-403d7337-f73e-5c81-8719-e853938c8985") { + Users (docID: "bae-5622129c-b893-5768-a3f4-8f745db4cc04") { name verified } @@ -217,7 +217,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad") { + Users (docID: "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc") { name verified } @@ -231,7 +231,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-3f1174ba-d9bc-5a6a-b0bc-8f19581f199d") { + Users (docID: "bae-38a4ebb2-583a-5b6e-8e90-a6fe9e13be06") { name verified } @@ -245,7 +245,7 @@ func TestSchemaMigrationQueryMultipleQueriesByDocID(t *testing.T) { }, testUtils.Request{ Request: `query { - Users (docID: "bae-0698bda7-2c69-5028-a26a-0a1c491b793b") { + Users (docID: "bae-4d2c0f6e-af73-54d9-ac8a-a419077ea1e5") { name verified } diff --git a/tests/integration/schema/updates/add/field/create_test.go b/tests/integration/schema/updates/add/field/create_test.go index af771d025c..32f10b1a60 100644 --- a/tests/integration/schema/updates/add/field/create_test.go +++ b/tests/integration/schema/updates/add/field/create_test.go @@ -50,7 +50,7 @@ func TestSchemaUpdatesAddFieldWithCreate(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", + "_docID": "bae-6845cfdf-cb0f-56a3-be3a-b5a67be5fbdc", "name": "John", "email": nil, }, @@ -98,21 +98,18 @@ func TestSchemaUpdatesAddFieldWithCreateAfterSchemaUpdate(t *testing.T) { testUtils.Request{ Request: `query { Users { - _docID name email } }`, Results: []map[string]any{ { - "_docID": "bae-1ff978e7-b6ab-5ca7-8344-7fdcff65f94e", - "name": "Shahzad", - "email": "sqlizded@yahoo.ca", + "name": "Shahzad", + "email": "sqlizded@yahoo.ca", }, { - "_docID": "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad", - "name": "John", - "email": nil, + "name": "John", + "email": nil, }, }, }, diff --git a/tests/integration/schema/updates/add/field/kind/foreign_object_test.go b/tests/integration/schema/updates/add/field/kind/foreign_object_test.go index 56bfbd2131..9b18500446 100644 --- a/tests/integration/schema/updates/add/field/kind/foreign_object_test.go +++ b/tests/integration/schema/updates/add/field/kind/foreign_object_test.go @@ -11,7 +11,6 @@ package kind import ( - "fmt" "testing" testUtils "github.com/sourcenetwork/defradb/tests/integration" @@ -122,8 +121,6 @@ func TestSchemaUpdatesAddFieldKindForeignObject_IDFieldInvalidKind(t *testing.T) } func TestSchemaUpdatesAddFieldKindForeignObject_Succeeds(t *testing.T) { - key1 := "bae-decf6467-4c7c-50d7-b09d-0a7097ef6bad" - test := testUtils.TestCase{ Description: "Test schema update, add field with kind foreign object, valid, functional", Actions: []any{ @@ -146,36 +143,15 @@ func TestSchemaUpdatesAddFieldKindForeignObject_Succeeds(t *testing.T) { ] `, }, - testUtils.Request{ - Request: `mutation { - create_Users(input: {name: "John"}) { - _docID - } - }`, - Results: []map[string]any{ - { - "_docID": key1, - }, + testUtils.CreateDoc{ + DocMap: map[string]any{ + "name": "John", }, }, - testUtils.Request{ - Request: fmt.Sprintf(`mutation { - create_Users(input: {name: "Keenan", foo: "%s"}) { - name - foo { - name - } - } - }`, - key1, - ), - Results: []map[string]any{ - { - "name": "Keenan", - "foo": map[string]any{ - "name": "John", - }, - }, + testUtils.CreateDoc{ + DocMap: map[string]any{ + "name": "Keenan", + "foo": testUtils.NewDocIndex(0, 0), }, }, testUtils.Request{ @@ -188,16 +164,16 @@ func TestSchemaUpdatesAddFieldKindForeignObject_Succeeds(t *testing.T) { } }`, Results: []map[string]any{ + { + "name": "John", + "foo": nil, + }, { "name": "Keenan", "foo": map[string]any{ "name": "John", }, }, - { - "name": "John", - "foo": nil, - }, }, }, }, diff --git a/tests/integration/subscription/subscription_test.go b/tests/integration/subscription/subscription_test.go index 02ac058c90..2de42f2793 100644 --- a/tests/integration/subscription/subscription_test.go +++ b/tests/integration/subscription/subscription_test.go @@ -30,12 +30,12 @@ func TestSubscriptionWithCreateMutations(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d", + "_docID": "bae-b3ce089b-f543-5984-be9f-ad7d08969f4e", "age": int64(27), "name": "John", }, { - "_docID": "bae-18def051-7f0f-5dc9-8a69-2a5e423f6b55", + "_docID": "bae-bc20b854-10b3-5408-b28c-f273ddda9434", "age": int64(31), "name": "Addo", }, @@ -78,16 +78,14 @@ func TestSubscriptionWithFilterAndOneCreateMutation(t *testing.T) { testUtils.SubscriptionRequest{ Request: `subscription { User(filter: {age: {_lt: 30}}) { - _docID name age } }`, Results: []map[string]any{ { - "_docID": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d", - "age": int64(27), - "name": "John", + "age": int64(27), + "name": "John", }, }, }, @@ -148,16 +146,14 @@ func TestSubscriptionWithFilterAndCreateMutations(t *testing.T) { testUtils.SubscriptionRequest{ Request: `subscription { User(filter: {age: {_lt: 30}}) { - _docID name age } }`, Results: []map[string]any{ { - "_docID": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d", - "age": int64(27), - "name": "John", + "age": int64(27), + "name": "John", }, }, }, @@ -216,7 +212,6 @@ func TestSubscriptionWithUpdateMutations(t *testing.T) { testUtils.SubscriptionRequest{ Request: `subscription { User { - _docID name age points @@ -224,7 +219,6 @@ func TestSubscriptionWithUpdateMutations(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d", "age": int64(27), "name": "John", "points": float64(45), @@ -274,7 +268,6 @@ func TestSubscriptionWithUpdateAllMutations(t *testing.T) { testUtils.SubscriptionRequest{ Request: `subscription { User { - _docID name age points @@ -282,15 +275,13 @@ func TestSubscriptionWithUpdateAllMutations(t *testing.T) { }`, Results: []map[string]any{ { - "_docID": "bae-0a24cf29-b2c2-5861-9d00-abd6250c475d", - "age": int64(27), - "name": "John", + "age": int64(31), + "name": "Addo", "points": float64(55), }, { - "_docID": "bae-76b0f3f5-964c-57c3-b44b-4a91bea70d40", - "age": int64(31), - "name": "Addo", + "age": int64(27), + "name": "John", "points": float64(55), }, }, @@ -303,10 +294,10 @@ func TestSubscriptionWithUpdateAllMutations(t *testing.T) { }`, Results: []map[string]any{ { - "name": "John", + "name": "Addo", }, { - "name": "Addo", + "name": "John", }, }, }, diff --git a/tests/integration/view/one_to_many/simple_test.go b/tests/integration/view/one_to_many/simple_test.go index 30f76987a2..9c846b6ba0 100644 --- a/tests/integration/view/one_to_many/simple_test.go +++ b/tests/integration/view/one_to_many/simple_test.go @@ -51,7 +51,6 @@ func TestView_OneToMany(t *testing.T) { } `, }, - // bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -60,10 +59,10 @@ func TestView_OneToMany(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "To Kill a Mockingbird", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "To Kill a Mockingbird", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -418,7 +417,6 @@ func TestView_OneToManyWithDoubleSidedRelation_Errors(t *testing.T) { } `, }, - // bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -427,10 +425,10 @@ func TestView_OneToManyWithDoubleSidedRelation_Errors(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "To Kill a Mockingbird", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "To Kill a Mockingbird", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { diff --git a/tests/integration/view/one_to_many/with_alias_test.go b/tests/integration/view/one_to_many/with_alias_test.go index be2d4a8f30..bfd6e443d9 100644 --- a/tests/integration/view/one_to_many/with_alias_test.go +++ b/tests/integration/view/one_to_many/with_alias_test.go @@ -51,7 +51,6 @@ func TestView_OneToManyWithAliasOnOuter(t *testing.T) { } `, }, - // bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -60,10 +59,10 @@ func TestView_OneToManyWithAliasOnOuter(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "To Kill a Mockingbird", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "To Kill a Mockingbird", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: `query { @@ -126,7 +125,6 @@ func TestView_OneToManyWithAliasOnInner(t *testing.T) { } `, }, - // bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -135,10 +133,10 @@ func TestView_OneToManyWithAliasOnInner(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "To Kill a Mockingbird", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "To Kill a Mockingbird", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` diff --git a/tests/integration/view/one_to_many/with_count_test.go b/tests/integration/view/one_to_many/with_count_test.go index 256b2057bb..2fa06d9aec 100644 --- a/tests/integration/view/one_to_many/with_count_test.go +++ b/tests/integration/view/one_to_many/with_count_test.go @@ -114,7 +114,6 @@ func TestView_OneToManyWithAliasedCount(t *testing.T) { } `, }, - // bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -123,17 +122,17 @@ func TestView_OneToManyWithAliasedCount(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "To Kill a Mockingbird", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "To Kill a Mockingbird", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Go Set a Watchman", - "author_id": "bae-ef9cd756-08e1-5f23-abeb-7b3e6351a68d" - }`, + DocMap: map[string]any{ + "name": "Go Set a Watchman", + "author_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` diff --git a/tests/integration/view/one_to_many/with_transform_test.go b/tests/integration/view/one_to_many/with_transform_test.go index 05b41516f4..13ef4f19c6 100644 --- a/tests/integration/view/one_to_many/with_transform_test.go +++ b/tests/integration/view/one_to_many/with_transform_test.go @@ -76,10 +76,10 @@ func TestView_OneToManyWithTransformOnOuter(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Shahnameh", - "author": "bae-db3c6923-c6a4-5386-8301-b20a5454bf1d" - }`, + DocMap: map[string]any{ + "name": "Shahnameh", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` diff --git a/tests/integration/view/one_to_one/identical_schema_test.go b/tests/integration/view/one_to_one/identical_schema_test.go index 90248ede17..ec83cd81cc 100644 --- a/tests/integration/view/one_to_one/identical_schema_test.go +++ b/tests/integration/view/one_to_one/identical_schema_test.go @@ -53,7 +53,6 @@ func TestView_OneToOneSameSchema(t *testing.T) { } `, }, - // bae-f3db7a4d-3db1-5d57-9996-32c3fdff99d3 testUtils.CreateDoc{ CollectionID: 0, Doc: `{ @@ -62,10 +61,10 @@ func TestView_OneToOneSameSchema(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Right hand 1", - "holding_id": "bae-f3db7a4d-3db1-5d57-9996-32c3fdff99d3" - }`, + DocMap: map[string]any{ + "name": "Right hand 1", + "holding_id": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` diff --git a/tests/integration/view/one_to_one/with_transform_test.go b/tests/integration/view/one_to_one/with_transform_test.go index e6da410ee1..d4270b454d 100644 --- a/tests/integration/view/one_to_one/with_transform_test.go +++ b/tests/integration/view/one_to_one/with_transform_test.go @@ -76,10 +76,10 @@ func TestView_OneToOneWithTransformOnOuter(t *testing.T) { }, testUtils.CreateDoc{ CollectionID: 1, - Doc: `{ - "name": "Shahnameh", - "author": "bae-db3c6923-c6a4-5386-8301-b20a5454bf1d" - }`, + DocMap: map[string]any{ + "name": "Shahnameh", + "author": testUtils.NewDocIndex(0, 0), + }, }, testUtils.Request{ Request: ` diff --git a/tests/integration/view/simple/simple_test.go b/tests/integration/view/simple/simple_test.go index 5dd74da8ed..df9ef60379 100644 --- a/tests/integration/view/simple/simple_test.go +++ b/tests/integration/view/simple/simple_test.go @@ -103,10 +103,10 @@ func TestView_SimpleMultipleDocs(t *testing.T) { }`, Results: []map[string]any{ { - "name": "Fred", + "name": "John", }, { - "name": "John", + "name": "Fred", }, }, }, diff --git a/tests/integration/view/simple/with_transform_test.go b/tests/integration/view/simple/with_transform_test.go index fc148357e9..b6d903a286 100644 --- a/tests/integration/view/simple/with_transform_test.go +++ b/tests/integration/view/simple/with_transform_test.go @@ -78,10 +78,10 @@ func TestView_SimpleWithTransform(t *testing.T) { `, Results: []map[string]any{ { - "fullName": "Fred", + "fullName": "John", }, { - "fullName": "John", + "fullName": "Fred", }, }, }, @@ -159,11 +159,11 @@ func TestView_SimpleWithMultipleTransforms(t *testing.T) { `, Results: []map[string]any{ { - "fullName": "Fred", + "fullName": "John", "age": 23, }, { - "fullName": "John", + "fullName": "Fred", "age": 23, }, }, @@ -309,10 +309,10 @@ func TestView_SimpleWithTransformReturningFewerDocsThanInput(t *testing.T) { `, Results: []map[string]any{ { - "name": "Shahzad", + "name": "John", }, { - "name": "John", + "name": "Shahzad", }, }, },