Skip to content
Snippets Groups Projects
Commit 30ea123f authored by Josh Brooks's avatar Josh Brooks
Browse files

Clean up tests

parent b22332fd
Branches
Tags
No related merge requests found
...@@ -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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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.Errorf("Failed to create mock host pool: %v", err) t.Fatalf("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
......
...@@ -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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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.Errorf("Failed to unmarshal ID in mock ndf: %v", err) t.Fatalf("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()
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment