Skip to content

Commit

Permalink
Add dialersession test
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-at-redhat committed Oct 15, 2024
1 parent 3ee08e0 commit af44702
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions pkg/backends/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package backends

import (
"context"
"reflect"
"sync"
"testing"
"time"

"github.com/ansible/receptor/pkg/logger"
"github.com/ansible/receptor/pkg/netceptor"
)

func TestdialerSession(t *testing.T) {

Check failure on line 14 in pkg/backends/utils_test.go

View workflow job for this annotation

GitHub Actions / lint-receptor

tests: TestdialerSession has malformed name: first letter after 'Test' must not be lowercase (govet)
type args struct {
ctx context.Context
wg *sync.WaitGroup
redial bool
redialDelay time.Duration
logger *logger.ReceptorLogger
df dialerFunc
}
tests := []struct {
name string
args args
want chan netceptor.BackendSession
wantErr bool
}{
{
name: "Positive",
args: args{
ctx: nil,
wg: nil,
redial: true,
redialDelay: 1 * time.Second,
logger: nil,
df: nil,
},
want: nil,
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := dialerSession(tt.args.ctx, tt.args.wg, tt.args.redial, tt.args.redialDelay, tt.args.logger, tt.args.df)
if (err != nil) != tt.wantErr {
t.Errorf("dialerSession() error = %v, wantErr %v", err, tt.wantErr)
return

Check failure on line 48 in pkg/backends/utils_test.go

View workflow job for this annotation

GitHub Actions / lint-receptor

return with no blank line before (nlreturn)
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("dialerSession() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit af44702

Please sign in to comment.