aboutsummaryrefslogtreecommitdiff
path: root/server_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2022-03-04 10:02:31 +0100
committerGravatar GitHub <noreply@github.com> 2022-03-04 10:02:31 +0100
commit7670c6eaa67bbc7d0eb495e04de8f01dc2e75e45 (patch)
treed46052a7513733734f9b0d9541186b4e669faecb /server_test.go
parentfeature: Keep the memory usage of the service at a stable level (#1216) (diff)
downloadfasthttp-7670c6eaa67bbc7d0eb495e04de8f01dc2e75e45.tar.gz
fasthttp-7670c6eaa67bbc7d0eb495e04de8f01dc2e75e45.tar.bz2
fasthttp-7670c6eaa67bbc7d0eb495e04de8f01dc2e75e45.zip
Fix windows tests (#1235)
* Fix windows tests Just ignore /../ tests on windows until we have proper suppor. * Remove useless test code This code was basically just testing if tcp works. To test if SO_REUSEPORT works we only have to try to listen on the same addr:port twice. * Fix test
Diffstat (limited to 'server_test.go')
-rw-r--r--server_test.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/server_test.go b/server_test.go
index cad3cf1..5436606 100644
--- a/server_test.go
+++ b/server_test.go
@@ -16,6 +16,7 @@ import (
"os"
"reflect"
"regexp"
+ "runtime"
"strings"
"sync"
"testing"
@@ -173,7 +174,7 @@ func TestServerPipelineFlush(t *testing.T) {
// Since the second request takes 200ms to finish we expect the first one to be flushed earlier.
d := time.Since(start)
- if d > time.Millisecond*100 {
+ if d >= time.Millisecond*200 {
t.Fatalf("had to wait for %v", d)
}
@@ -573,12 +574,15 @@ func TestRequestCtxRedirect(t *testing.T) {
testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "x.html?b=1#aaa=bbb&cc=ddd", "http://qqq/foo/x.html?b=1#aaa=bbb&cc=ddd")
testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "/x.html", "http://qqq/x.html")
testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "/x.html#aaa=bbb&cc=ddd", "http://qqq/x.html#aaa=bbb&cc=ddd")
- testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "../x.html", "http://qqq/x.html")
- testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "../../x.html", "http://qqq/x.html")
- testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "./.././../x.html", "http://qqq/x.html")
testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "http://foo.bar/baz", "http://foo.bar/baz")
testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "https://foo.bar/baz", "https://foo.bar/baz")
testRequestCtxRedirect(t, "https://foo.com/bar?aaa", "//google.com/aaa?bb", "https://google.com/aaa?bb")
+
+ if runtime.GOOS != "windows" {
+ testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "../x.html", "http://qqq/x.html")
+ testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "../../x.html", "http://qqq/x.html")
+ testRequestCtxRedirect(t, "http://qqq/foo/bar?baz=111", "./.././../x.html", "http://qqq/x.html")
+ }
}
func testRequestCtxRedirect(t *testing.T, origURL, redirectURL, expectedURL string) {