Skip to content
Snippets Groups Projects
Commit 5e187d37 authored by Malte Bauch's avatar Malte Bauch
Browse files

adapted the testcase blueprints

parent be368991
No related branches found
No related tags found
3 merge requests!97Resolve "PND handling via CLI and database",!91"Overhaul Architecture",!90Develop
Pipeline #63815 passed with warnings
......@@ -8,7 +8,7 @@ import (
func TestDevice_Add(t *testing.T) {
type fields struct {
Device ygot.GoStruct
ygot.GoStruct
SBI SouthboundInterface
Config DeviceConfig
Transport Transport
......@@ -26,7 +26,7 @@ func TestDevice_Add(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
d := Device{
Device: tt.fields.Device,
GoStruct: tt.fields.SBI.Schema().Root,
SBI: tt.fields.SBI,
Config: tt.fields.Config,
Transport: tt.fields.Transport,
......
......@@ -9,6 +9,7 @@ import (
func TestNewPND(t *testing.T) {
type args struct {
name string
desc string
sbi SouthboundInterface
}
tests := []struct {
......@@ -20,7 +21,7 @@ func TestNewPND(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := NewPND(tt.args.name, tt.args.sbi); !reflect.DeepEqual(got, tt.want) {
if got := NewPND(tt.args.name, tt.args.desc, tt.args.sbi); !reflect.DeepEqual(got, tt.want) {
t.Errorf("NewPND() = %v, want %v", got, tt.want)
}
})
......@@ -28,15 +29,32 @@ func TestNewPND(t *testing.T) {
}
func Test_addSbi(t *testing.T) {
type fields struct {
name string
desc string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]*Device
}
type args struct {
sbi SouthboundInterface
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := addSbi(); (err != nil) != tt.wantErr {
pnd := &pndImplementation{
name: tt.fields.name,
description: tt.fields.desc,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.addSbi(tt.args.sbi); (err != nil) != tt.wantErr {
t.Errorf("addSbi() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -62,8 +80,9 @@ func Test_destroy(t *testing.T) {
func Test_pndImplementation_AddDevice(t *testing.T) {
type fields struct {
name string
desc string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
device Device
......@@ -79,11 +98,12 @@ func Test_pndImplementation_AddDevice(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
description: tt.fields.desc,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.AddDevice(tt.args.device); (err != nil) != tt.wantErr {
if err := pnd.AddDevice(&tt.args.device); (err != nil) != tt.wantErr {
t.Errorf("AddDevice() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -94,11 +114,15 @@ func Test_pndImplementation_AddSbi(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
sbi SouthboundInterface
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
......@@ -106,11 +130,11 @@ func Test_pndImplementation_AddSbi(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.AddSbi(); (err != nil) != tt.wantErr {
if err := pnd.AddSbi(tt.args.sbi); (err != nil) != tt.wantErr {
t.Errorf("AddSbi() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -121,7 +145,7 @@ func Test_pndImplementation_Destroy(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
tests := []struct {
name string
......@@ -133,9 +157,9 @@ func Test_pndImplementation_Destroy(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.Destroy(); (err != nil) != tt.wantErr {
t.Errorf("Destroy() error = %v, wantErr %v", err, tt.wantErr)
......@@ -148,7 +172,7 @@ func Test_pndImplementation_RemoveDevice(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
uuid uuid.UUID
......@@ -164,9 +188,9 @@ func Test_pndImplementation_RemoveDevice(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.RemoveDevice(tt.args.uuid); (err != nil) != tt.wantErr {
t.Errorf("RemoveDevice() error = %v, wantErr %v", err, tt.wantErr)
......@@ -179,11 +203,15 @@ func Test_pndImplementation_RemoveSbi(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
sbi SouthboundInterface
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
......@@ -191,11 +219,11 @@ func Test_pndImplementation_RemoveSbi(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.RemoveSbi(); (err != nil) != tt.wantErr {
if err := pnd.RemoveSbi(tt.args.sbi.SbiIdentifier()); (err != nil) != tt.wantErr {
t.Errorf("RemoveSbi() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -206,7 +234,7 @@ func Test_pndImplementation_addDevice(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
device Device
......@@ -222,11 +250,11 @@ func Test_pndImplementation_addDevice(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.addDevice(tt.args.device); (err != nil) != tt.wantErr {
if err := pnd.addDevice(&tt.args.device); (err != nil) != tt.wantErr {
t.Errorf("addDevice() error = %v, wantErr %v", err, tt.wantErr)
}
})
......@@ -237,7 +265,7 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]Device
devices map[uuid.UUID]*Device
}
type args struct {
uuid uuid.UUID
......@@ -253,9 +281,9 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
pnd := &pndImplementation{
Name: tt.fields.name,
Sbi: tt.fields.sbi,
Devices: tt.fields.devices,
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.removeDevice(tt.args.uuid); (err != nil) != tt.wantErr {
t.Errorf("removeDevice() error = %v, wantErr %v", err, tt.wantErr)
......@@ -265,15 +293,31 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
}
func Test_removeSbi(t *testing.T) {
type fields struct {
name string
sbi map[string]SouthboundInterface
devices map[uuid.UUID]*Device
}
type args struct {
uuid uuid.UUID
sbi SouthboundInterface
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := removeSbi(); (err != nil) != tt.wantErr {
pnd := &pndImplementation{
name: tt.fields.name,
sbi: tt.fields.sbi,
devices: tt.fields.devices,
}
if err := pnd.removeSbi(tt.args.sbi.SbiIdentifier()); (err != nil) != tt.wantErr {
t.Errorf("removeSbi() error = %v, wantErr %v", err, tt.wantErr)
}
})
......
......@@ -16,7 +16,7 @@ func TestOpenConfig_SbiIdentifier(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{
Transport: tt.fields.transport,
transport: tt.fields.transport,
}
if got := oc.SbiIdentifier(); got != tt.want {
t.Errorf("SbiIdentifier() = %v, want %v", got, tt.want)
......@@ -42,7 +42,7 @@ func TestOpenConfig_OpenconfigInterfaces(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
oc := &OpenConfig{
Transport: tt.fields.transport,
transport: tt.fields.transport,
}
oc.OpenconfigInterfaces(tt.args.device)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment