-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae56fa4
commit 70121bb
Showing
7 changed files
with
537 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
tests/integration/net/state_driven/peer/with_create_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// 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/defradb/config" | ||
testUtils "github.com/sourcenetwork/defradb/tests/integration/net/state_driven" | ||
) | ||
|
||
func TestP2PCreateDoesNotSync(t *testing.T) { | ||
test := testUtils.P2PTestCase{ | ||
NodeConfig: []*config.Config{ | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
}, | ||
NodePeers: map[int][]int{ | ||
1: { | ||
0, | ||
}, | ||
}, | ||
SeedDocuments: map[int]string{ | ||
0: `{ | ||
"Name": "Shahzad", | ||
"Age": 300 | ||
}`, | ||
}, | ||
Creates: map[int]map[int]string{ | ||
0: { | ||
1: `{ | ||
"Name": "John", | ||
"Age": 21 | ||
}`, | ||
}, | ||
}, | ||
Results: map[int]map[int]map[string]any{ | ||
0: { | ||
0: { | ||
"Age": uint64(300), | ||
}, | ||
1: { | ||
"Age": uint64(21), | ||
}, | ||
}, | ||
1: { | ||
0: { | ||
"Age": uint64(300), | ||
}, | ||
// Peer sync should not sync new documents to nodes | ||
}, | ||
}, | ||
} | ||
|
||
testUtils.ExecuteTestCase(t, test) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
tests/integration/net/state_driven/peer_replicator/with_create_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// 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_replicator_test | ||
|
||
/* | ||
import ( | ||
"testing" | ||
"github.com/sourcenetwork/defradb/config" | ||
testUtils "github.com/sourcenetwork/defradb/tests/integration/net/state_driven" | ||
) | ||
*/ | ||
|
||
/* | ||
// This test fails and should be uncommented once the behaviour is corrected | ||
// The mode of failure is somewhat flaky, possibly due to the test framework | ||
// however I do not believe the framework should accomodate this (the bug | ||
// looks to be a production issue). Likely part of: | ||
// https://github.com/sourcenetwork/defradb/issues/1000 | ||
func TestP2PPeerReplicatorWithCreate(t *testing.T) { | ||
test := testUtils.P2PTestCase{ | ||
NodeConfig: []*config.Config{ | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
}, | ||
NodePeers: map[int][]int{ | ||
1: { | ||
0, | ||
}, | ||
}, | ||
NodeReplicators: map[int][]int{ | ||
0: { | ||
2, | ||
}, | ||
}, | ||
SeedDocuments: map[int]string{ | ||
0: `{ | ||
"Name": "John", | ||
"Age": 21 | ||
}`, | ||
}, | ||
Creates: map[int]map[int]string{ | ||
0: { | ||
1: `{ | ||
"Name": "Shahzad", | ||
"Age": 3000 | ||
}`, | ||
}, | ||
}, | ||
Results: map[int]map[int]map[string]any{ | ||
0: { | ||
0: { | ||
"Age": uint64(21), | ||
}, | ||
1: { | ||
"Age": uint64(3000), | ||
}, | ||
}, | ||
1: { | ||
0: { | ||
"Age": uint64(21), | ||
}, | ||
}, | ||
2: { | ||
0: { | ||
"Age": uint64(21), | ||
}, | ||
1: { | ||
"Age": uint64(3000), | ||
}, | ||
}, | ||
}, | ||
} | ||
testUtils.ExecuteTestCase(t, test) | ||
} | ||
*/ |
76 changes: 76 additions & 0 deletions
76
tests/integration/net/state_driven/peer_replicator/with_update_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// 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_replicator_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sourcenetwork/defradb/config" | ||
testUtils "github.com/sourcenetwork/defradb/tests/integration/net/state_driven" | ||
) | ||
|
||
// This test documents a bug and the behaviour should be corrected | ||
// https://github.com/sourcenetwork/defradb/issues/1000 | ||
func TestP2PPeerReplicatorWithUpdate(t *testing.T) { | ||
test := testUtils.P2PTestCase{ | ||
NodeConfig: []*config.Config{ | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
}, | ||
NodePeers: map[int][]int{ | ||
1: { | ||
0, | ||
}, | ||
}, | ||
NodeReplicators: map[int][]int{ | ||
0: { | ||
2, | ||
}, | ||
}, | ||
SeedDocuments: map[int]string{ | ||
0: `{ | ||
"Name": "John", | ||
"Age": 21 | ||
}`, | ||
}, | ||
Updates: map[int]map[int][]string{ | ||
0: { | ||
0: { | ||
`{ | ||
"Age": 60 | ||
}`, | ||
}, | ||
}, | ||
}, | ||
Results: map[int]map[int]map[string]any{ | ||
0: { | ||
0: { | ||
"Age": uint64(60), | ||
}, | ||
}, | ||
1: { | ||
0: { | ||
"Age": uint64(60), | ||
}, | ||
}, | ||
2: { | ||
0: { | ||
// This is incorrect behaviour - node 2 should not | ||
// be updated and this value should be `21` | ||
"Age": uint64(60), | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
testUtils.ExecuteTestCase(t, test) | ||
} |
Oops, something went wrong.