blob: fe0639ccc850fbbdb4f5e2848ff280bc3d2bfadf [file] [log] [blame]
vinokuma04dc9f82023-07-31 15:47:49 +05301/*
2* Copyright 2022-present Open Networking Foundation
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14 */
15
16package controller
17
18import (
19 "context"
20 "testing"
21 "voltha-go-controller/internal/test/mocks"
22
23 "github.com/golang/mock/gomock"
24)
25
26func TestPendingProfilesTask_Start(t *testing.T) {
27 type args struct {
28 ctx context.Context
29 taskID uint8
30 }
31 tests := []struct {
32 name string
33 args args
34 wantErr bool
35 }{
36 {
37 name: "PendingProfilesTask_Start",
38 args: args{
39 ctx: context.Background(),
40 taskID: uint8(1),
41 },
42 },
43 }
44 for _, tt := range tests {
45 t.Run(tt.name, func(t *testing.T) {
46 ppt := &PendingProfilesTask{
47 device: &Device{
48 ID: "test_device",
49 },
50 }
51 appMock := mocks.NewMockApp(gomock.NewController(t))
52 _ = NewController(context.Background(), appMock)
53 appMock.EXPECT().SetRebootFlag(gomock.Any()).AnyTimes()
54 appMock.EXPECT().TriggerPendingProfileDeleteReq(gomock.Any(), gomock.Any()).AnyTimes()
55 appMock.EXPECT().TriggerPendingMigrateServicesReq(gomock.Any(), gomock.Any()).AnyTimes()
56 appMock.EXPECT().UpdateMvlanProfilesForDevice(gomock.Any(), gomock.Any()).AnyTimes()
57 if err := ppt.Start(tt.args.ctx, tt.args.taskID); (err != nil) != tt.wantErr {
58 t.Errorf("PendingProfilesTask.Start() error = %v, wantErr %v", err, tt.wantErr)
59 }
60 })
61 }
62}