-
Manuel Kieweg authored
Revert "Merge branch 'develop' into '74-follow-up-from-draft-resolve-pnd-handling-via-cli-and-database'" This reverts commit 7d6f3967
Manuel Kieweg authoredRevert "Merge branch 'develop' into '74-follow-up-from-draft-resolve-pnd-handling-via-cli-and-database'" This reverts commit 7d6f3967
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
cli-handling_test.go 9.09 KiB
package nucleus
import (
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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)
}
})
}
}