Skip to content

Commit

Permalink
Fix tests on windows
Browse files Browse the repository at this point in the history
Sergio Andres Virviescas Santana committed Dec 28, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d12f34a commit 396af01
Showing 2 changed files with 35 additions and 21 deletions.
54 changes: 34 additions & 20 deletions atreugo_windows_test.go
Original file line number Diff line number Diff line change
@@ -8,45 +8,61 @@ import (
)

func TestAtreugo_ListenAndServe(t *testing.T) { //nolint:funlen
type args struct {
addr string
tlsEnable bool
// reuseport bool
}

type want struct {
getErr bool
}

tests := []struct {
name string
args args
args Config
want want
}{
{
name: "NormalOk",
args: args{
addr: "localhost:8081",
tlsEnable: false,
args: Config{
Addr: "localhost:8083",
TLSEnable: false,
},
want: want{
getErr: false,
},
},
{
name: "Reuseport",
args: Config{
Addr: "localhost:8083",
TLSEnable: false,
Reuseport: true,
},
want: want{
getErr: false,
},
},
{
name: "ReuseportError",
args: Config{
Addr: "invalid",
TLSEnable: false,
Reuseport: true,
},
want: want{
getErr: true,
},
},
{
name: "TLSError",
args: args{
addr: "localhost:8081",
tlsEnable: true,
args: Config{
Addr: "localhost:8081",
TLSEnable: true,
},
want: want{
getErr: true,
},
},
{
name: "InvalidAddr",
args: args{
addr: "0101:999999999999999999",
args: Config{
Addr: "0101:999999999999999999",
},
want: want{
getErr: true,
@@ -58,11 +74,9 @@ func TestAtreugo_ListenAndServe(t *testing.T) { //nolint:funlen
tt := test

t.Run(tt.name, func(t *testing.T) {
s := New(Config{
Addr: tt.args.addr,
LogLevel: "error",
TLSEnable: tt.args.tlsEnable,
})
tt.args.Logger = testLog

s := New(tt.args)

errCh := make(chan error, 1)
go func() {
2 changes: 1 addition & 1 deletion listener_windows_test.go
Original file line number Diff line number Diff line change
@@ -73,8 +73,8 @@ func TestAtreugo_getListener(t *testing.T) { // nolint:funlen

t.Run(tt.name, func(t *testing.T) {
cfg := Config{
Logger: testLog,
Addr: tt.args.addr,
LogLevel: "fatal",
Reuseport: tt.args.reuseport,
}
if tt.args.network != "" {

0 comments on commit 396af01

Please sign in to comment.