Skip to content
Snippets Groups Projects
Commit 6bc64a3e authored by André Sterba's avatar André Sterba
Browse files

Adjust tests

parent ed74dcfa
No related branches found
No related tags found
5 merge requests!376Add additional example application hostname-checker,!349Northbound refactoring to implement NIB concept for devices,!343Add basic application framework and example application to show interaction between events an NBI,!339Create basic venv-manager for use with arista,!324Provide prototype implementation for topology handling
Pipeline #107243 passed
...@@ -151,7 +151,7 @@ func bootstrapUnitTest() { ...@@ -151,7 +151,7 @@ func bootstrapUnitTest() {
jwtManager := rbacImpl.NewJWTManager("", (10000 * time.Hour)) jwtManager := rbacImpl.NewJWTManager("", (10000 * time.Hour))
nodeStore := store.NewGenericStore[nodes.Node]() nodeStore := store.NewGenericStore[nodes.Node]()
nodeService := nodes.NewNodeService(nodeStore) nodeService := nodes.NewNodeService(nodeStore, eventService)
portStore := store.NewGenericStore[ports.Port]() portStore := store.NewGenericStore[ports.Port]()
portService := ports.NewPortService(portStore) portService := ports.NewPortService(portStore)
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"reflect" "reflect"
"testing" "testing"
eventservice "code.fbi.h-da.de/danet/gosdn/controller/eventService"
"code.fbi.h-da.de/danet/gosdn/controller/topology/nodes" "code.fbi.h-da.de/danet/gosdn/controller/topology/nodes"
"code.fbi.h-da.de/danet/gosdn/controller/topology/ports" "code.fbi.h-da.de/danet/gosdn/controller/topology/ports"
"code.fbi.h-da.de/danet/gosdn/controller/topology/store" "code.fbi.h-da.de/danet/gosdn/controller/topology/store"
...@@ -95,12 +96,12 @@ func TestNewRoutingTableService(t *testing.T) { ...@@ -95,12 +96,12 @@ func TestNewRoutingTableService(t *testing.T) {
name: "should create a new topology service", name: "should create a new topology service",
args: args{ args: args{
store: getTestStoreWithRoutingTables(t, []RoutingTable{}), store: getTestStoreWithRoutingTables(t, []RoutingTable{}),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
want: NewRoutingTableService( want: NewRoutingTableService(
getTestStoreWithRoutingTables(t, []RoutingTable{}), getTestStoreWithRoutingTables(t, []RoutingTable{}),
nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
), ),
}, },
...@@ -137,7 +138,7 @@ func TestTopologyService_EnsureExists(t *testing.T) { ...@@ -137,7 +138,7 @@ func TestTopologyService_EnsureExists(t *testing.T) {
nodeService: nodes.NewNodeService(getTestStoreWithNodes( nodeService: nodes.NewNodeService(getTestStoreWithNodes(
t, t,
[]nodes.Node{}, []nodes.Node{},
)), ), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts( portService: ports.NewPortService(getTestStoreWithPorts(
t, t,
[]ports.Port{}, []ports.Port{},
...@@ -156,7 +157,7 @@ func TestTopologyService_EnsureExists(t *testing.T) { ...@@ -156,7 +157,7 @@ func TestTopologyService_EnsureExists(t *testing.T) {
nodeService: nodes.NewNodeService(getTestStoreWithNodes( nodeService: nodes.NewNodeService(getTestStoreWithNodes(
t, t,
[]nodes.Node{getTestNode()}, []nodes.Node{getTestNode()},
)), ), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts( portService: ports.NewPortService(getTestStoreWithPorts(
t, t,
[]ports.Port{getTestPort()}, []ports.Port{getTestPort()},
...@@ -208,7 +209,7 @@ func TestRoutingTableService_Update(t *testing.T) { ...@@ -208,7 +209,7 @@ func TestRoutingTableService_Update(t *testing.T) {
name: "should update an existing routing table", name: "should update an existing routing table",
fields: fields{ fields: fields{
store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}), store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
args: args{ args: args{
...@@ -252,7 +253,7 @@ func TestRoutingTableService_Delete(t *testing.T) { ...@@ -252,7 +253,7 @@ func TestRoutingTableService_Delete(t *testing.T) {
name: "should delete an existing routing table", name: "should delete an existing routing table",
fields: fields{ fields: fields{
store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}), store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
args: args{ args: args{
...@@ -264,7 +265,7 @@ func TestRoutingTableService_Delete(t *testing.T) { ...@@ -264,7 +265,7 @@ func TestRoutingTableService_Delete(t *testing.T) {
name: "should fail if a routing table does not exists", name: "should fail if a routing table does not exists",
fields: fields{ fields: fields{
store: store.NewGenericStore[RoutingTable](), store: store.NewGenericStore[RoutingTable](),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
args: args{ args: args{
...@@ -307,7 +308,7 @@ func TestRoutingTableService_Get(t *testing.T) { ...@@ -307,7 +308,7 @@ func TestRoutingTableService_Get(t *testing.T) {
name: "should error if routing table with uuid is not in store", name: "should error if routing table with uuid is not in store",
fields: fields{ fields: fields{
store: getTestStoreWithRoutingTables(t, []RoutingTable{}), store: getTestStoreWithRoutingTables(t, []RoutingTable{}),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
args: args{ args: args{
...@@ -367,7 +368,7 @@ func TestRoutingTableService_GetAll(t *testing.T) { ...@@ -367,7 +368,7 @@ func TestRoutingTableService_GetAll(t *testing.T) {
name: "should get all stored routing tables", name: "should get all stored routing tables",
fields: fields{ fields: fields{
store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}), store: getTestStoreWithRoutingTables(t, []RoutingTable{getTestRoutingTable()}),
nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{})), nodeService: nodes.NewNodeService(getTestStoreWithNodes(t, []nodes.Node{}), eventservice.NewMockEventService()),
portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})), portService: ports.NewPortService(getTestStoreWithPorts(t, []ports.Port{})),
}, },
want: []RoutingTable{getTestRoutingTable()}, want: []RoutingTable{getTestRoutingTable()},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment