Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dialersession test #1165

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
})
}
}
Loading