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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
0d5a889b
Commit
0d5a889b
authored
3 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
added some testing
parent
931e58ae
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!53
Release
,
!24
Lesure/offline nodes
,
!15
prevent hostpool from adding stale nodes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
network/gateway/hostpool_test.go
+5
-7
5 additions, 7 deletions
network/gateway/hostpool_test.go
with
5 additions
and
7 deletions
network/gateway/hostpool_test.go
+
5
−
7
View file @
0d5a889b
...
@@ -316,6 +316,11 @@ func TestHostPool_ForceReplace(t *testing.T) {
...
@@ -316,6 +316,11 @@ func TestHostPool_ForceReplace(t *testing.T) {
testStorage
:=
storage
.
InitTestingSession
(
t
)
testStorage
:=
storage
.
InitTestingSession
(
t
)
addGwChan
:=
make
(
chan
network
.
NodeGateway
)
addGwChan
:=
make
(
chan
network
.
NodeGateway
)
// Construct custom params
params
:=
DefaultPoolParams
()
params
.
PoolSize
=
uint32
(
len
(
testNdf
.
Gateways
))
// Add a stale node
newGateway
:=
ndf
.
Gateway
{
newGateway
:=
ndf
.
Gateway
{
ID
:
id
.
NewIdFromUInt
(
27
,
id
.
Gateway
,
t
)
.
Bytes
(),
ID
:
id
.
NewIdFromUInt
(
27
,
id
.
Gateway
,
t
)
.
Bytes
(),
}
}
...
@@ -326,10 +331,6 @@ func TestHostPool_ForceReplace(t *testing.T) {
...
@@ -326,10 +331,6 @@ func TestHostPool_ForceReplace(t *testing.T) {
testNdf
.
Gateways
=
append
(
testNdf
.
Gateways
,
newGateway
)
testNdf
.
Gateways
=
append
(
testNdf
.
Gateways
,
newGateway
)
testNdf
.
Nodes
=
append
(
testNdf
.
Nodes
,
newNode
)
testNdf
.
Nodes
=
append
(
testNdf
.
Nodes
,
newNode
)
// Construct custom params
params
:=
DefaultPoolParams
()
params
.
PoolSize
=
uint32
(
len
(
testNdf
.
Gateways
)
-
1
)
// One of the nodes is set to stale
// Pull all gateways from ndf into host manager
// Pull all gateways from ndf into host manager
for
_
,
gw
:=
range
testNdf
.
Gateways
{
for
_
,
gw
:=
range
testNdf
.
Gateways
{
...
@@ -356,9 +357,6 @@ func TestHostPool_ForceReplace(t *testing.T) {
...
@@ -356,9 +357,6 @@ func TestHostPool_ForceReplace(t *testing.T) {
// Add all gateways to hostPool's map
// Add all gateways to hostPool's map
for
i
:=
uint32
(
0
);
i
<
params
.
PoolSize
;
i
++
{
for
i
:=
uint32
(
0
);
i
<
params
.
PoolSize
;
i
++
{
gw
:=
testNdf
.
Gateways
[
i
]
gw
:=
testNdf
.
Gateways
[
i
]
if
i
==
0
{
continue
}
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
gwId
,
err
:=
id
.
Unmarshal
(
gw
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
t
.
Fatalf
(
"Failed to unmarshal ID in mock ndf: %v"
,
err
)
...
...
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