Newer
Older
pb "code.fbi.h-da.de/cocsn/gosdn/api/proto"
"context"
"google.golang.org/protobuf/types/known/emptypb"
"reflect"
"testing"
)
func Test_buf_Write(t *testing.T) {
type args struct {
p []byte
}
tests := []struct {
name string
b buf
args args
wantN int
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotN, err := tt.b.Write(tt.args.p)
if (err != nil) != tt.wantErr {
t.Errorf("Write() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotN != tt.wantN {
t.Errorf("Write() gotN = %v, want %v", gotN, tt.wantN)
}
})
}
}
func Test_getCLIGoing(t *testing.T) {
type args struct {
core *Core
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
})
}
}
func Test_server_AddDevice(t *testing.T) {
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *pb.AddDeviceRequest
}
tests := []struct {
name string
fields fields
args args
want *pb.AddDeviceReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.AddDevice(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("AddDevice() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("AddDevice() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_BroadcastLog(t *testing.T) {
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
log *pb.LogReply
}
tests := []struct {
name string
fields fields
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_ = &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
})
}
}
func Test_server_CreateLogStream(t *testing.T) {
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
req *emptypb.Empty
stream pb.GrpcCli_CreateLogStreamServer
}
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) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
if err := s.CreateLogStream(tt.args.req, tt.args.stream); (err != nil) != tt.wantErr {
t.Errorf("CreateLogStream() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func Test_server_CreatePND(t *testing.T) {
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *pb.CreatePNDRequest
}
tests := []struct {
name string
fields fields
args args
want *pb.CreatePNDReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.CreatePND(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("CreatePND() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("CreatePND() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_GetAllPNDs(t *testing.T) {
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *emptypb.Empty
}
tests := []struct {
name string
fields fields
args args
want *pb.AllPNDsReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.GetAllPNDs(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("GetAllPNDs() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetAllPNDs() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_GetAllSBINames(t *testing.T) {
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *emptypb.Empty
}
tests := []struct {
name string
fields fields
args args
want *pb.AllSBINamesReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.GetAllSBINames(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("GetAllSBINames() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetAllSBINames() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_HandleDeviceGetRequest(t *testing.T) {
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *pb.DeviceGetRequest
}
tests := []struct {
name string
fields fields
args args
want *pb.DeviceGetReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.HandleDeviceGetRequest(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("HandleDeviceGetRequest() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("HandleDeviceGetRequest() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_SayHello(t *testing.T) {
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *pb.HelloRequest
}
tests := []struct {
name string
fields fields
args args
want *pb.HelloReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.SayHello(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("SayHello() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("SayHello() got = %v, want %v", got, tt.want)
}
})
}
}
func Test_server_Shutdown(t *testing.T) {
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
type fields struct {
UnimplementedGrpcCliServer pb.UnimplementedGrpcCliServer
core *Core
logConnections []*logConnection
}
type args struct {
ctx context.Context
in *pb.ShutdownRequest
}
tests := []struct {
name string
fields fields
args args
want *pb.ShutdownReply
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &server{
UnimplementedGrpcCliServer: tt.fields.UnimplementedGrpcCliServer,
core: tt.fields.core,
logConnections: tt.fields.logConnections,
}
got, err := s.Shutdown(tt.args.ctx, tt.args.in)
if (err != nil) != tt.wantErr {
t.Errorf("Shutdown() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Shutdown() got = %v, want %v", got, tt.want)
}
})
}