forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Handle collection commits over P2P
- Loading branch information
1 parent
dae2820
commit f58fd2c
Showing
6 changed files
with
268 additions
and
92 deletions.
There are no files selected for viewing
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
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
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
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
67 changes: 67 additions & 0 deletions
67
tests/integration/query/commits/branchables/peer_index_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,67 @@ | ||
// Copyright 2024 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 branchables | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sourcenetwork/immutable" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
) | ||
|
||
func TestQueryCommitsBranchables_SyncsIndexAcrossPeerConnection(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Actions: []any{ | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.RandomNetworkingConfig(), | ||
testUtils.SchemaUpdate{ | ||
Schema: ` | ||
type Users @branchable { | ||
name: String @index | ||
} | ||
`, | ||
}, | ||
testUtils.ConnectPeers{ | ||
SourceNodeID: 1, | ||
TargetNodeID: 0, | ||
}, | ||
testUtils.SubscribeToCollection{ | ||
NodeID: 1, | ||
CollectionIDs: []int{0}, | ||
}, | ||
testUtils.CreateDoc{ | ||
NodeID: immutable.Some(0), | ||
Doc: `{ | ||
"name": "John" | ||
}`, | ||
}, | ||
testUtils.WaitForSync{}, | ||
testUtils.Request{ | ||
NodeID: immutable.Some(1), | ||
Request: `query { | ||
Users (filter: {name: {_eq: "John"}}){ | ||
name | ||
} | ||
}`, | ||
Results: map[string]any{ | ||
"Users": []map[string]any{ | ||
{ | ||
"name": "John", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
testUtils.ExecuteTestCase(t, test) | ||
} |
Oops, something went wrong.