File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
"net/http/httptest"
12
12
"net/url"
13
13
"os"
14
+ "runtime"
14
15
"strings"
15
16
"testing"
16
17
"time"
@@ -927,7 +928,11 @@ func TestEcho_Start(t *testing.T) {
927
928
case <- time .After (250 * time .Millisecond ):
928
929
t .Fatal ("start did not error out" )
929
930
case err := <- errChan :
930
- assert .Contains (t , err .Error (), "bind: address already in use" )
931
+ expectContains := "bind: address already in use"
932
+ if runtime .GOOS == "windows" {
933
+ expectContains = "bind: Only one usage of each socket address"
934
+ }
935
+ assert .Contains (t , err .Error (), expectContains )
931
936
}
932
937
}
933
938
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
15
15
"net"
16
16
"net/http"
17
17
"os"
18
+ "runtime"
18
19
"strings"
19
20
"testing"
20
21
"time"
@@ -119,7 +120,11 @@ func TestStartConfig_Start(t *testing.T) {
119
120
t .Errorf ("missing error" )
120
121
return
121
122
}
122
- assert .True (t , strings .Contains (err .Error (), "connect: connection refused" ))
123
+ expectContains := "connect: connection refused"
124
+ if runtime .GOOS == "windows" {
125
+ expectContains = "No connection could be made"
126
+ }
127
+ assert .True (t , strings .Contains (err .Error (), expectContains ))
123
128
}
124
129
125
130
func TestStartConfig_GracefulShutdown (t * testing.T ) {
@@ -207,7 +212,11 @@ func TestStartConfig_GracefulShutdown(t *testing.T) {
207
212
code , body , err = doGet (fmt .Sprintf ("http://%v/ok" , addr ))
208
213
assert .Error (t , err )
209
214
if err != nil {
210
- assert .True (t , strings .Contains (err .Error (), "connect: connection refused" ))
215
+ expectContains := "connect: connection refused"
216
+ if runtime .GOOS == "windows" {
217
+ expectContains = "No connection could be made"
218
+ }
219
+ assert .True (t , strings .Contains (err .Error (), expectContains ))
211
220
}
212
221
assert .Equal (t , 0 , code )
213
222
assert .Equal (t , "" , body )
You can’t perform that action at this time.
0 commit comments