Skip to content
Snippets Groups Projects
Commit 0d5a889b authored by Jake Taylor's avatar Jake Taylor
Browse files

added some testing

parent 931e58ae
Branches
Tags
3 merge requests!53Release,!24Lesure/offline nodes,!15prevent hostpool from adding stale nodes
...@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment