diff --git a/pkg/backends/tcp_test.go b/pkg/backends/tcp_test.go index 305196627..797ee4840 100644 --- a/pkg/backends/tcp_test.go +++ b/pkg/backends/tcp_test.go @@ -112,3 +112,57 @@ func TestTCPListenerStart(t *testing.T) { }) } } + +func TestTCPDialerStart(t *testing.T) { + type fields struct { + address string + redial bool + tls *tls.Config + logger *logger.ReceptorLogger + } + type args struct { + ctx context.Context + wg *sync.WaitGroup + } + tests := []struct { + name string + fields fields + args args + want chan netceptor.BackendSession + wantErr bool + }{ + { + name: "Positive", + fields: fields{ + address: "127.0.0.1:9998", + redial: true, + tls: nil, + logger: logger.NewReceptorLogger("TCPtest"), + }, + args: args{ + ctx: context.Background(), + wg: &sync.WaitGroup{}, + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b := &TCPDialer{ + address: tt.fields.address, + redial: tt.fields.redial, + tls: tt.fields.tls, + logger: tt.fields.logger, + } + got, err := b.Start(tt.args.ctx, tt.args.wg) + if (err != nil) != tt.wantErr { + t.Errorf("TCPDialer.Start() error = %+v, wantErr %+v", err, tt.wantErr) + + return + } + if got == nil { + t.Errorf("TCPDialer.Start() got = nil") + } + }) + } +}