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
30ea123f
Commit
30ea123f
authored
Apr 20, 2021
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Clean up tests
parent
b22332fd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
network/gateway/hostpool_test.go
+14
-18
14 additions, 18 deletions
network/gateway/hostpool_test.go
network/gateway/sender_test.go
+6
-9
6 additions, 9 deletions
network/gateway/sender_test.go
with
20 additions
and
27 deletions
network/gateway/hostpool_test.go
+
14
−
18
View file @
30ea123f
...
@@ -50,7 +50,7 @@ func TestNewHostPool(t *testing.T) {
...
@@ -50,7 +50,7 @@ func TestNewHostPool(t *testing.T) {
_
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
_
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
}
}
...
@@ -86,7 +86,7 @@ func TestHostPool_ManageHostPool(t *testing.T) {
...
@@ -86,7 +86,7 @@ func TestHostPool_ManageHostPool(t *testing.T) {
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
// Construct a list of new gateways/nodes to add to ndf
// Construct a list of new gateways/nodes to add to ndf
...
@@ -447,13 +447,12 @@ func TestHostPool_GetPreferred(t *testing.T) {
...
@@ -447,13 +447,12 @@ func TestHostPool_GetPreferred(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
hostMap
[
*
gwId
]
=
true
hostMap
[
*
gwId
]
=
true
...
@@ -465,7 +464,7 @@ func TestHostPool_GetPreferred(t *testing.T) {
...
@@ -465,7 +464,7 @@ func TestHostPool_GetPreferred(t *testing.T) {
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
retrievedList
:=
testPool
.
getPreferred
(
targets
)
retrievedList
:=
testPool
.
getPreferred
(
targets
)
...
@@ -517,13 +516,12 @@ func TestHostPool_GetAny(t *testing.T) {
...
@@ -517,13 +516,12 @@ func TestHostPool_GetAny(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
@@ -532,7 +530,7 @@ func TestHostPool_GetAny(t *testing.T) {
...
@@ -532,7 +530,7 @@ func TestHostPool_GetAny(t *testing.T) {
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
requested
:=
3
requested
:=
3
...
@@ -574,13 +572,12 @@ func TestHostPool_ForceAdd(t *testing.T) {
...
@@ -574,13 +572,12 @@ func TestHostPool_ForceAdd(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
@@ -635,13 +632,12 @@ func TestHostPool_UpdateConns_AddGateways(t *testing.T) {
...
@@ -635,13 +632,12 @@ func TestHostPool_UpdateConns_AddGateways(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
@@ -650,7 +646,7 @@ func TestHostPool_UpdateConns_AddGateways(t *testing.T) {
...
@@ -650,7 +646,7 @@ func TestHostPool_UpdateConns_AddGateways(t *testing.T) {
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
// Construct a list of new gateways/nodes to add to ndf
// Construct a list of new gateways/nodes to add to ndf
...
@@ -725,7 +721,7 @@ func TestHostPool_UpdateConns_RemoveGateways(t *testing.T) {
...
@@ -725,7 +721,7 @@ func TestHostPool_UpdateConns_RemoveGateways(t *testing.T) {
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testPool
,
err
:=
newHostPool
(
params
,
rng
,
testNdf
,
manager
,
testStorage
,
addGwChan
)
testStorage
,
addGwChan
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to create mock host pool: %v"
,
err
)
t
.
Fatal
f
(
"Failed to create mock host pool: %v"
,
err
)
}
}
// Construct a list of new gateways/nodes to add to ndf
// Construct a list of new gateways/nodes to add to ndf
...
...
This diff is collapsed.
Click to expand it.
network/gateway/sender_test.go
+
6
−
9
View file @
30ea123f
...
@@ -48,13 +48,12 @@ func TestSender_SendToAny(t *testing.T) {
...
@@ -48,13 +48,12 @@ func TestSender_SendToAny(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
@@ -120,13 +119,12 @@ func TestSender_SendToPreferred(t *testing.T) {
...
@@ -120,13 +119,12 @@ func TestSender_SendToPreferred(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
@@ -207,13 +205,12 @@ func TestSender_SendToSpecific(t *testing.T) {
...
@@ -207,13 +205,12 @@ func TestSender_SendToSpecific(t *testing.T) {
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatal
f
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
}
}
// Add mock gateway to manager
// Add mock gateway to manager
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
_
,
err
=
manager
.
AddHost
(
gwId
,
gw
.
Address
,
nil
,
connect
.
GetDefaultHostParams
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
Fatalf
(
"Could not add mock host to manager: %v"
,
err
)
t
.
FailNow
()
}
}
}
}
...
...
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