From 136464ad4fb51019d045a68dd6bca2ea50cc24cf Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Mar 2023 15:41:38 -0400 Subject: [PATCH 1/7] Fix wait mechanic for peer col subscription Was only working accidentally with the existing tests, and does not work with tests soon to be added. --- tests/integration/p2p.go | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/integration/p2p.go b/tests/integration/p2p.go index b996ce47f4..13a7e37270 100644 --- a/tests/integration/p2p.go +++ b/tests/integration/p2p.go @@ -118,20 +118,16 @@ func connectPeers( time.Sleep(100 * time.Millisecond) nodeCollections := map[int][]int{} - for _, a := range testCase.Actions { - switch action := a.(type) { - case SubscribeToCollection: - // Node collections must be populated before re-iterating through the full action set as - // documents created before the subscription must still be waited on. - nodeCollections[action.NodeID] = append(nodeCollections[action.NodeID], action.CollectionID) - } - } - sourceToTargetEvents := []int{0} targetToSourceEvents := []int{0} waitIndex := 0 for _, a := range testCase.Actions { switch action := a.(type) { + case SubscribeToCollection: + // This is order dependent, items should be added in the same action-loop that reads them + // as 'stuff' done before collection subscription should not be synced. + nodeCollections[action.NodeID] = append(nodeCollections[action.NodeID], action.CollectionID) + case CreateDoc: sourceCollectionSubscribed := collectionSubscribedTo(nodeCollections, cfg.SourceNodeID, action.CollectionID) targetCollectionSubscribed := collectionSubscribedTo(nodeCollections, cfg.TargetNodeID, action.CollectionID) @@ -141,8 +137,8 @@ func connectPeers( // created on the target. if (!action.NodeID.HasValue() || action.NodeID.Value() == cfg.TargetNodeID) && - targetCollectionSubscribed { - sourceToTargetEvents[waitIndex] += 1 + sourceCollectionSubscribed { + targetToSourceEvents[waitIndex] += 1 } // Peers sync trigger sync events for documents that exist prior to configuration, even if they already @@ -150,8 +146,8 @@ func connectPeers( // created on the source. if (!action.NodeID.HasValue() || action.NodeID.Value() == cfg.SourceNodeID) && - sourceCollectionSubscribed { - targetToSourceEvents[waitIndex] += 1 + targetCollectionSubscribed { + sourceToTargetEvents[waitIndex] += 1 } case UpdateDoc: From 7e76896bef3ef43653ff106c2d9fe4f327df5e29 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Mar 2023 16:02:00 -0400 Subject: [PATCH 2/7] Add peer create tests across schema versions --- .../simple/peer/with_create_add_field_test.go | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 tests/integration/net/state/simple/peer/with_create_add_field_test.go diff --git a/tests/integration/net/state/simple/peer/with_create_add_field_test.go b/tests/integration/net/state/simple/peer/with_create_add_field_test.go new file mode 100644 index 0000000000..7daf91b709 --- /dev/null +++ b/tests/integration/net/state/simple/peer/with_create_add_field_test.go @@ -0,0 +1,225 @@ +// 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 peer_test + +import ( + "testing" + + "github.com/sourcenetwork/immutable" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestP2PPeerCreateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConnectPeers{ + SourceNodeID: 1, + TargetNodeID: 0, + }, + testUtils.SubscribeToCollection{ + NodeID: 1, + CollectionID: 0, + }, + testUtils.CreateDoc{ + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + // John should still be synced to the second node, even though it has + // not been updated to contain the new 'Email' field. + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "John", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +func TestP2PPeerCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will sync docs to + NodeID: immutable.Some(1), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConnectPeers{ + SourceNodeID: 1, + TargetNodeID: 0, + }, + testUtils.SubscribeToCollection{ + NodeID: 1, + CollectionID: 0, + }, + testUtils.CreateDoc{ + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + // John should still be synced to the second node, even though it has + // been updated with a new 'Email' field that does not exist on the + // source node. + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "John", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +// Documentation test: This may be undesirable behaviour and the test should be +// updated once the behaviour has been fixed. +func TestP2PPeerCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on all nodes + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConnectPeers{ + SourceNodeID: 1, + TargetNodeID: 0, + }, + testUtils.SubscribeToCollection{ + NodeID: 1, + CollectionID: 0, + }, + testUtils.CreateDoc{ + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + // Even though 'Email' exists on both nodes, the value of the field has not + // successfully been synced. + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "John", + "Email": nil, + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} From 1dc6ee92987bd7c71612529bd9d68f8729256b29 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Mar 2023 16:14:11 -0400 Subject: [PATCH 3/7] Add peer update tests across schema versions --- .../simple/peer/with_update_add_field_test.go | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 tests/integration/net/state/simple/peer/with_update_add_field_test.go diff --git a/tests/integration/net/state/simple/peer/with_update_add_field_test.go b/tests/integration/net/state/simple/peer/with_update_add_field_test.go new file mode 100644 index 0000000000..2b9c21f496 --- /dev/null +++ b/tests/integration/net/state/simple/peer/with_update_add_field_test.go @@ -0,0 +1,181 @@ +// 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 peer_test + +import ( + "testing" + + "github.com/sourcenetwork/immutable" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.CreateDoc{ + Doc: `{ + "Name": "John" + }`, + }, + testUtils.ConnectPeers{ + SourceNodeID: 1, + TargetNodeID: 0, + }, + testUtils.SubscribeToCollection{ + NodeID: 1, + CollectionID: 0, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.UpdateDoc{ + // Update the new field on the first node only, and allow the value to sync + NodeID: immutable.Some(0), + Doc: `{ + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.UpdateDoc{ + // Update the existing field on the first node only, and allow the value to sync + // We need to make sure any errors caused by the first update to not break the sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "Shahzad" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + // The second update should still be received by the second node, updating Name + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.CreateDoc{ + Doc: `{ + "Name": "John" + }`, + }, + testUtils.ConnectPeers{ + SourceNodeID: 1, + TargetNodeID: 0, + }, + testUtils.SubscribeToCollection{ + NodeID: 1, + CollectionID: 0, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.UpdateDoc{ + // Update the new field and existing field on the first node only, and allow the values to sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} From 94acdf2812168d30c626d7bc1aaa7e022cd8f707 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Mar 2023 16:21:55 -0400 Subject: [PATCH 4/7] Add replicator create tests across schema versions --- .../replicator/with_create_add_field_test.go | 195 ++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 tests/integration/net/state/simple/replicator/with_create_add_field_test.go diff --git a/tests/integration/net/state/simple/replicator/with_create_add_field_test.go b/tests/integration/net/state/simple/replicator/with_create_add_field_test.go new file mode 100644 index 0000000000..5566054868 --- /dev/null +++ b/tests/integration/net/state/simple/replicator/with_create_add_field_test.go @@ -0,0 +1,195 @@ +// 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 replicator + +import ( + "testing" + + "github.com/sourcenetwork/immutable" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConfigureReplicator{ + SourceNodeID: 0, + TargetNodeID: 1, + }, + testUtils.CreateDoc{ + // Create John on the first (source) node only, and allow the value to sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "John", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we sync docs to + NodeID: immutable.Some(1), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConfigureReplicator{ + SourceNodeID: 0, + TargetNodeID: 1, + }, + testUtils.CreateDoc{ + // Create John on the first (source) node only, and allow the value to sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "John", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +// Documentation test: This may be undesirable behaviour and the test should be +// updated once the behaviour has been fixed. +func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.SchemaPatch{ + // Patch the schema on all nodes + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.ConfigureReplicator{ + SourceNodeID: 0, + TargetNodeID: 1, + }, + testUtils.CreateDoc{ + // Create John on the first (source) node only, and allow the value to sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "John", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + // Even though 'Email' exists on both nodes, the value of the field has not + // successfully been synced. + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "John", + "Email": nil, + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} From bd044877bea41848ea0487c1dbe91d1407a83ae8 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Mar 2023 16:28:22 -0400 Subject: [PATCH 5/7] Add replicator update tests across schema versions --- .../replicator/with_update_add_field_test.go | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 tests/integration/net/state/simple/replicator/with_update_add_field_test.go diff --git a/tests/integration/net/state/simple/replicator/with_update_add_field_test.go b/tests/integration/net/state/simple/replicator/with_update_add_field_test.go new file mode 100644 index 0000000000..6a3f1445f1 --- /dev/null +++ b/tests/integration/net/state/simple/replicator/with_update_add_field_test.go @@ -0,0 +1,173 @@ +// 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 replicator + +import ( + "testing" + + "github.com/sourcenetwork/immutable" + + testUtils "github.com/sourcenetwork/defradb/tests/integration" +) + +func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.CreateDoc{ + Doc: `{ + "Name": "John" + }`, + }, + testUtils.ConfigureReplicator{ + SourceNodeID: 0, + TargetNodeID: 1, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.UpdateDoc{ + // Update the new field on the first node only, and allow the value to sync + NodeID: immutable.Some(0), + Doc: `{ + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.UpdateDoc{ + // Update the existing field on the first node only, and allow the value to sync + // We need to make sure any errors caused by the first update to not break the sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "Shahzad" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + // The second update should still be received by the second node, updating Name + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} + +func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { + test := testUtils.TestCase{ + Actions: []any{ + testUtils.RandomNetworkingConfig(), + testUtils.RandomNetworkingConfig(), + testUtils.SchemaUpdate{ + Schema: ` + type Users { + Name: String + } + `, + }, + testUtils.CreateDoc{ + Doc: `{ + "Name": "John" + }`, + }, + testUtils.ConfigureReplicator{ + SourceNodeID: 0, + TargetNodeID: 1, + }, + testUtils.SchemaPatch{ + // Patch the schema on the node that we will directly create a doc on + NodeID: immutable.Some(0), + Patch: ` + [ + { "op": "add", "path": "/Users/Schema/Fields/-", "value": {"Name": "Email", "Kind": 11} } + ] + `, + }, + testUtils.UpdateDoc{ + // Update the new field and existing field on the first node only, and allow the values to sync + NodeID: immutable.Some(0), + Doc: `{ + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca" + }`, + }, + testUtils.WaitForSync{}, + testUtils.Request{ + NodeID: immutable.Some(0), + Request: `query { + Users { + Name + Email + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + "Email": "imnotyourbuddyguy@source.ca", + }, + }, + }, + testUtils.Request{ + NodeID: immutable.Some(1), + Request: `query { + Users { + Name + } + }`, + Results: []map[string]any{ + { + "Name": "Shahzad", + }, + }, + }, + }, + } + + testUtils.ExecuteTestCase(t, []string{"Users"}, test) +} From 994489f5c729e04ad1194e60d578d314116f80ae Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Thu, 16 Mar 2023 13:38:08 -0400 Subject: [PATCH 6/7] PR FIXUP - Fix comments --- .../net/state/simple/peer/with_update_add_field_test.go | 2 +- .../state/simple/replicator/with_update_add_field_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/integration/net/state/simple/peer/with_update_add_field_test.go b/tests/integration/net/state/simple/peer/with_update_add_field_test.go index 2b9c21f496..0bb08cf581 100644 --- a/tests/integration/net/state/simple/peer/with_update_add_field_test.go +++ b/tests/integration/net/state/simple/peer/with_update_add_field_test.go @@ -129,7 +129,7 @@ func TestP2PPeerUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing.T) { CollectionID: 0, }, testUtils.SchemaPatch{ - // Patch the schema on the node that we will directly create a doc on + // Patch the schema on the node that we will directly update the doc on NodeID: immutable.Some(0), Patch: ` [ diff --git a/tests/integration/net/state/simple/replicator/with_update_add_field_test.go b/tests/integration/net/state/simple/replicator/with_update_add_field_test.go index 6a3f1445f1..22c2da4759 100644 --- a/tests/integration/net/state/simple/replicator/with_update_add_field_test.go +++ b/tests/integration/net/state/simple/replicator/with_update_add_field_test.go @@ -40,7 +40,7 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t TargetNodeID: 1, }, testUtils.SchemaPatch{ - // Patch the schema on the node that we will directly create a doc on + // Patch the schema on the node that we will update the doc on NodeID: immutable.Some(0), Patch: ` [ @@ -57,7 +57,7 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersionMultistep(t }, testUtils.UpdateDoc{ // Update the existing field on the first node only, and allow the value to sync - // We need to make sure any errors caused by the first update to not break the sync + // We need to make sure any errors caused by the first update do not break the sync NodeID: immutable.Some(0), Doc: `{ "Name": "Shahzad" @@ -121,7 +121,7 @@ func TestP2PReplicatorUpdateWithNewFieldSyncsDocsToOlderSchemaVersion(t *testing TargetNodeID: 1, }, testUtils.SchemaPatch{ - // Patch the schema on the node that we will directly create a doc on + // Patch the schema on the node that we will directly update the doc on NodeID: immutable.Some(0), Patch: ` [ From 684413445161a8539d9f425b1d486fdc15f5d1ae Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Thu, 16 Mar 2023 14:07:26 -0400 Subject: [PATCH 7/7] PR FIXUP - Attach issue to bug-documentation tests --- .../net/state/simple/peer/with_create_add_field_test.go | 3 ++- .../net/state/simple/replicator/with_create_add_field_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration/net/state/simple/peer/with_create_add_field_test.go b/tests/integration/net/state/simple/peer/with_create_add_field_test.go index 7daf91b709..08dfd2a54b 100644 --- a/tests/integration/net/state/simple/peer/with_create_add_field_test.go +++ b/tests/integration/net/state/simple/peer/with_create_add_field_test.go @@ -148,8 +148,9 @@ func TestP2PPeerCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t *testing.T) { testUtils.ExecuteTestCase(t, []string{"Users"}, test) } -// Documentation test: This may be undesirable behaviour and the test should be +// Documentation test: This is undesirable behaviour and the test should be // updated once the behaviour has been fixed. +// Issue: https://github.com/sourcenetwork/defradb/issues/1185 func TestP2PPeerCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion(t *testing.T) { test := testUtils.TestCase{ Actions: []any{ diff --git a/tests/integration/net/state/simple/replicator/with_create_add_field_test.go b/tests/integration/net/state/simple/replicator/with_create_add_field_test.go index 5566054868..7093c13fb6 100644 --- a/tests/integration/net/state/simple/replicator/with_create_add_field_test.go +++ b/tests/integration/net/state/simple/replicator/with_create_add_field_test.go @@ -121,8 +121,9 @@ func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToNewerSchemaVersion(t testUtils.ExecuteTestCase(t, []string{"Users"}, test) } -// Documentation test: This may be undesirable behaviour and the test should be +// Documentation test: This is undesirable behaviour and the test should be // updated once the behaviour has been fixed. +// Issue: https://github.com/sourcenetwork/defradb/issues/1185 func TestP2POneToOneReplicatorCreateWithNewFieldSyncsDocsToUpdatedSchemaVersion(t *testing.T) { test := testUtils.TestCase{ Actions: []any{