Skip to content

Commit

Permalink
fix test and add variant
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Oct 11, 2024
1 parent 0069b45 commit 01d7ff5
Showing 1 changed file with 84 additions and 3 deletions.
87 changes: 84 additions & 3 deletions tests/integration/net/simple/replicator/with_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ func TestP2POneToOneReplicator_ManyDocsUpdateWithTargetNodeTemporarilyOffline_Sh
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
DocID: 0,
Doc: `{Age: 22}`,
Doc: `{"Age": 22}`,
},
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
DocID: 1,
Doc: `{Age: 23}`,
Doc: `{"Age": 23}`,
},
testUtils.Start{
NodeID: immutable.Some(1),
Expand All @@ -195,7 +195,88 @@ func TestP2POneToOneReplicator_ManyDocsUpdateWithTargetNodeTemporarilyOffline_Sh
"Age": int64(23),
},
{
"Age": int64(21),
"Age": int64(22),
},
},
},
},
},
}

testUtils.ExecuteTestCase(t, test)
}

func TestP2POneToOneReplicator_ManyDocsUpdateWithTargetNodeTemporarilyOfflineAfterCreate_ShouldSucceed(t *testing.T) {
test := testUtils.TestCase{
SupportedDatabaseTypes: immutable.Some(
[]testUtils.DatabaseType{
// This test only supports file type databases since it requires the ability to
// stop and start a node without losing data.
testUtils.BadgerFileType,
},
),
Actions: []any{
testUtils.RandomNetworkingConfig(),
testUtils.RandomNetworkingConfig(),
testUtils.SchemaUpdate{
Schema: `
type Users {
Name: String
Age: Int
}
`,
},
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",
"Age": 21
}`,
},
testUtils.CreateDoc{
// Create Fred on the first (source) node only, and allow the value to sync
NodeID: immutable.Some(0),
Doc: `{
"Name": "Fred",
"Age": 22
}`,
},
testUtils.WaitForSync{},
testUtils.Close{
NodeID: immutable.Some(1),
},
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
DocID: 0,
Doc: `{"Age": 22}`,
},
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
DocID: 1,
Doc: `{"Age": 23}`,
},
testUtils.Start{
NodeID: immutable.Some(1),
},
testUtils.WaitForSync{},
testUtils.Request{
Request: `query {
Users {
Age
}
}`,
Results: map[string]any{
"Users": []map[string]any{
{
"Age": int64(23),
},
{
"Age": int64(22),
},
},
},
Expand Down

0 comments on commit 01d7ff5

Please sign in to comment.