Skip to content

Commit 7abc12b

Browse files
committed
Update unit tests
1 parent 24ae718 commit 7abc12b

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

internal/grpc/grpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var (
7373
func NewGrpcConnection(ctx context.Context, agentConfig *config.Config,
7474
commandConfig *config.Command,
7575
) (*GrpcConnection, error) {
76-
if commandConfig == nil || commandConfig.Server.Type != config.Grpc {
76+
if commandConfig == nil || commandConfig.Server == nil || commandConfig.Server.Type != config.Grpc {
7777
return nil, errors.New("invalid command server settings")
7878
}
7979

internal/grpc/grpc_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -638,25 +638,3 @@ func Test_serverAddress(t *testing.T) {
638638
})
639639
}
640640
}
641-
642-
func Test_serverAddress_NilCommand(t *testing.T) {
643-
ctx := context.Background()
644-
645-
// Test with nil command config - should panic as the function doesn't handle nil
646-
assert.Panics(t, func() {
647-
serverAddress(ctx, nil)
648-
}, "serverAddress should panic with nil command config")
649-
}
650-
651-
func Test_serverAddress_NilServer(t *testing.T) {
652-
ctx := context.Background()
653-
654-
// Test with nil server config - should also panic
655-
commandConfig := &config.Command{
656-
Server: nil,
657-
}
658-
659-
assert.Panics(t, func() {
660-
serverAddress(ctx, commandConfig)
661-
}, "serverAddress should panic with nil server config")
662-
}

0 commit comments

Comments
 (0)