From f29dc92fc1023a75c6d086b912c8a5328203986c Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Thu, 27 Jun 2024 12:01:53 -0400 Subject: [PATCH] Support asserting on doc index in test results --- .../net/one_to_many/peer/with_create_update_test.go | 4 ++-- tests/integration/utils2.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) 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 e6862754de..1cedd82495 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 @@ -81,7 +81,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin Results: []map[string]any{ { "Name": "Gulistan", - "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499", + "Author_id": testUtils.NewDocIndex(0, 0), "Author": map[string]any{ "Name": "Saadi", }, @@ -102,7 +102,7 @@ func TestP2POneToManyPeerWithCreateUpdateLinkingSyncedDocToUnsyncedDoc(t *testin Results: []map[string]any{ { "Name": "Gulistan", - "Author_id": "bae-6a4c24c0-7b0b-5f51-a274-132d7ca90499", + "Author_id": testUtils.NewDocIndex(0, 0), // "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/utils2.go b/tests/integration/utils2.go index 5e9d089ccd..a1071de4aa 100644 --- a/tests/integration/utils2.go +++ b/tests/integration/utils2.go @@ -1880,6 +1880,16 @@ func assertRequestResults( valueSet := anyOfByField[dfk] valueSet = append(valueSet, actualValue) anyOfByField[dfk] = valueSet + case DocIndex: + expectedDocID := s.documents[r.CollectionIndex][r.Index].ID().String() + assertResultsEqual( + s.t, + s.clientType, + expectedDocID, + actualValue, + fmt.Sprintf("node: %v, doc: %v", nodeID, docIndex), + ) + default: assertResultsEqual( s.t,