Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
c9b4514e
Commit
c9b4514e
authored
Mar 22, 2022
by
Jono Wenger
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/XX-3829/Triggers' into XX-3829/Triggers
parents
abc125e2
2b99f604
No related branches found
No related tags found
4 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
,
!187
Xx 3829/triggers
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
network/nodes/registrar_test.go
+10
-11
10 additions, 11 deletions
network/nodes/registrar_test.go
network/nodes/store_test.go
+1
-1
1 addition, 1 deletion
network/nodes/store_test.go
network/nodes/utils_test.go
+7
-6
7 additions, 6 deletions
network/nodes/utils_test.go
with
18 additions
and
18 deletions
network/nodes/registrar_test.go
+
10
−
11
View file @
c9b4514e
...
...
@@ -11,10 +11,9 @@ import (
"bytes"
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/c
lient/storage/versioned
"
commNetwork
"gitlab.com/elixxir/c
omms/network
"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/large"
...
...
@@ -26,7 +25,6 @@ import (
// Tests that LoadRegistrar returns a new Registrar when none exists in the KV.
func
TestLoadRegistrar_New
(
t
*
testing
.
T
)
{
connect
.
TestingOnlyDisableTLS
=
true
kv
:=
versioned
.
NewKV
(
make
(
ekv
.
Memstore
))
session
:=
storage
.
InitTestingSession
(
t
)
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1
,
1
,
csprng
.
NewSystemRNG
)
p
:=
gateway
.
DefaultPoolParams
()
...
...
@@ -36,8 +34,9 @@ func TestLoadRegistrar_New(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create new sender: %+v"
,
err
)
}
nodeChan
:=
make
(
chan
commNetwork
.
NodeGateway
,
InputChanLen
)
r
,
err
:=
LoadRegistrar
(
kv
,
session
,
sender
,
NewMockClientComms
(),
rngGen
)
r
,
err
:=
LoadRegistrar
(
session
,
sender
,
NewMockClientComms
(),
rngGen
,
nodeChan
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create new registrar: %+v"
,
err
)
}
...
...
@@ -51,7 +50,7 @@ func TestLoadRegistrar_New(t *testing.T) {
}
func
TestLoadRegistrar_Load
(
t
*
testing
.
T
)
{
testR
,
kv
:=
makeTestRegistrar
(
t
)
testR
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
// Add a test nodes key
...
...
@@ -69,7 +68,7 @@ func TestLoadRegistrar_Load(t *testing.T) {
testR
.
add
(
nodeId
,
k
,
expectedValid
,
expectedKeyId
)
// Load the store and check its attributes
r
,
err
:=
LoadRegistrar
(
kv
,
testR
.
session
,
testR
.
sender
,
testR
.
comms
,
testR
.
rng
)
r
,
err
:=
LoadRegistrar
(
testR
.
session
,
testR
.
sender
,
testR
.
comms
,
testR
.
rng
,
testR
.
c
)
if
err
!=
nil
{
t
.
Fatalf
(
"Unable to load store: %+v"
,
err
)
}
...
...
@@ -90,7 +89,7 @@ func TestLoadRegistrar_Load(t *testing.T) {
}
func
Test_registrar_GetKeys
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
// Set up the circuit
...
...
@@ -116,7 +115,7 @@ func Test_registrar_GetKeys(t *testing.T) {
}
func
Test_registrar_GetKeys_Missing
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
// Set up the circuit
...
...
@@ -147,7 +146,7 @@ func Test_registrar_GetKeys_Missing(t *testing.T) {
}
func
Test_registrar_Has
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
nodeId
:=
id
.
NewIdFromString
(
"test"
,
id
.
Node
,
t
)
...
...
@@ -165,7 +164,7 @@ func Test_registrar_Has(t *testing.T) {
// Tests that Has returns false when it does not have.
func
Test_registrar_Has_Not
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
nodeId
:=
id
.
NewIdFromString
(
"test"
,
id
.
Node
,
t
)
...
...
@@ -175,7 +174,7 @@ func Test_registrar_Has_Not(t *testing.T) {
}
func
Test_registrar_NumRegistered
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
if
r
.
NumRegistered
()
!=
0
{
...
...
This diff is collapsed.
Click to expand it.
network/nodes/store_test.go
+
1
−
1
View file @
c9b4514e
...
...
@@ -16,7 +16,7 @@ import (
// Happy path add/remove test.
func
Test_registrar_add_remove
(
t
*
testing
.
T
)
{
r
,
_
:=
makeTestRegistrar
(
t
)
r
:=
makeTestRegistrar
(
t
)
grp
:=
cyclic
.
NewGroup
(
large
.
NewInt
(
173
),
large
.
NewInt
(
2
))
nodeId
:=
id
.
NewIdFromString
(
"test"
,
id
.
Node
,
t
)
...
...
This diff is collapsed.
Click to expand it.
network/nodes/utils_test.go
+
7
−
6
View file @
c9b4514e
...
...
@@ -10,10 +10,9 @@ package nodes
import
(
"gitlab.com/elixxir/client/network/gateway"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/storage/versioned"
pb
"gitlab.com/elixxir/comms/mixmessages"
commNetwork
"gitlab.com/elixxir/comms/network"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
...
...
@@ -22,9 +21,9 @@ import (
)
// Creates new registrar for testing.
func
makeTestRegistrar
(
t
*
testing
.
T
)
(
*
registrar
,
*
versioned
.
KV
)
{
func
makeTestRegistrar
(
t
*
testing
.
T
)
*
registrar
{
connect
.
TestingOnlyDisableTLS
=
true
kv
:=
versioned
.
NewKV
(
make
(
ekv
.
Memstore
))
session
:=
storage
.
InitTestingSession
(
t
)
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1
,
1
,
csprng
.
NewSystemRNG
)
p
:=
gateway
.
DefaultPoolParams
()
...
...
@@ -35,12 +34,14 @@ func makeTestRegistrar(t *testing.T) (*registrar, *versioned.KV) {
t
.
Fatalf
(
"Failed to create new sender: %+v"
,
err
)
}
r
,
err
:=
LoadRegistrar
(
kv
,
session
,
sender
,
NewMockClientComms
(),
rngGen
)
nodeChan
:=
make
(
chan
commNetwork
.
NodeGateway
,
InputChanLen
)
r
,
err
:=
LoadRegistrar
(
session
,
sender
,
NewMockClientComms
(),
rngGen
,
nodeChan
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create new registrar: %+v"
,
err
)
}
return
r
.
(
*
registrar
)
,
kv
return
r
.
(
*
registrar
)
}
// Mock client comms object adhering to RegisterNodeCommsInterface for testing.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment