vgc UTs part 4
Change-Id: I0e78854fefb8f0ad270a84bc88982f859a0d5995
diff --git a/internal/pkg/application/flowevent_test.go b/internal/pkg/application/flowevent_test.go
index 400176a..b6b8738 100644
--- a/internal/pkg/application/flowevent_test.go
+++ b/internal/pkg/application/flowevent_test.go
@@ -132,6 +132,21 @@
},
},
},
+ {
+ name: "ProcessUsIgmpFlowAddEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ device: "test_device",
+ eType: EventTypeControlFlowAdded,
+ eventData: voltPortVnet,
+ },
+ flowStatus: intf.FlowStatus{
+ Device: "test_device",
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -161,6 +176,19 @@
},
},
},
+ {
+ name: "ProcessServiceFlowAddEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ device: "test_device",
+ eventData: voltService,
+ },
+ flowStatus: intf.FlowStatus{
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -188,6 +216,18 @@
},
},
},
+ {
+ name: "ProcessControlFlowAddEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ eventData: voltPortVnet,
+ },
+ flowStatus: intf.FlowStatus{
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -215,6 +255,18 @@
},
},
},
+ {
+ name: "ProcessServiceFlowDelEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ eventData: voltService,
+ },
+ flowStatus: intf.FlowStatus{
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -245,6 +297,18 @@
},
},
},
+ {
+ name: "ProcessControlFlowDelEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ eventData: voltPortVnet,
+ },
+ flowStatus: intf.FlowStatus{
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -278,6 +342,18 @@
},
},
},
+ {
+ name: "ProcessMcastFlowDelEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ eventData: mvlanProfile,
+ },
+ flowStatus: intf.FlowStatus{
+ Status: uint32(1001),
+ },
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -288,3 +364,56 @@
})
}
}
+
+func TestProcessDeviceFlowDelEvent(t *testing.T) {
+ type args struct {
+ cntx context.Context
+ event *FlowEvent
+ flowStatus intf.FlowStatus
+ }
+ tests := []struct {
+ name string
+ args args
+ }{
+ {
+ name: "ProcessDeviceFlowDelEvent",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ device: test_device,
+ eventData: voltVnet,
+ },
+ flowStatus: intf.FlowStatus{
+ Device: test_device,
+ },
+ },
+ },
+ {
+ name: "ProcessDeviceFlowDelEvent_else_condition",
+ args: args{
+ cntx: context.Background(),
+ event: &FlowEvent{
+ device: test_device,
+ eventData: voltVnet,
+ },
+ flowStatus: intf.FlowStatus{
+ Device: test_device,
+ Status: uint32(1001),
+ },
+ },
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ switch tt.name {
+ case "ProcessDeviceFlowDelEvent":
+ dbintf := mocks.NewMockDBIntf(gomock.NewController(t))
+ db = dbintf
+ dbintf.EXPECT().PutVnet(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil).AnyTimes()
+ ProcessDeviceFlowDelEvent(tt.args.cntx, tt.args.event, tt.args.flowStatus)
+ case "ProcessDeviceFlowDelEvent_else_condition":
+ ProcessDeviceFlowDelEvent(tt.args.cntx, tt.args.event, tt.args.flowStatus)
+ }
+ })
+ }
+}