Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
0fcfe16d
Commit
0fcfe16d
authored
Jan 24, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integration: Document each test cases
parent
990f9ed4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
integration-tests/nghttpx_http1_test.go
integration-tests/nghttpx_http1_test.go
+12
-0
integration-tests/nghttpx_http2_test.go
integration-tests/nghttpx_http2_test.go
+32
-0
integration-tests/nghttpx_spdy_test.go
integration-tests/nghttpx_spdy_test.go
+10
-0
No files found.
integration-tests/nghttpx_http1_test.go
View file @
0fcfe16d
...
...
@@ -10,6 +10,7 @@ import (
"testing"
)
// TestH1H1PlainGET tests whether simple HTTP/1 GET request works.
func
TestH1H1PlainGET
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -27,6 +28,8 @@ func TestH1H1PlainGET(t *testing.T) {
}
}
// TestH1H1PlainGETClose tests whether simple HTTP/1 GET request with
// Connetion: close request header field works.
func
TestH1H1PlainGETClose
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -47,6 +50,8 @@ func TestH1H1PlainGETClose(t *testing.T) {
}
}
// TestH1H1MultipleRequestCL tests that server rejects request which
// contains multiple Content-Length header fields.
func
TestH1H1MultipleRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
@@ -74,6 +79,8 @@ Content-Length: 1
}
}
// TestH1H1ConnectFailure tests that server handles the situation that
// connection attempt to HTTP/1 backend failed.
func
TestH1H1ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -93,6 +100,7 @@ func TestH1H1ConnectFailure(t *testing.T) {
}
}
// TestH1H1GracefulShutdown tests graceful shutdown.
func
TestH1H1GracefulShutdown
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -131,6 +139,8 @@ func TestH1H1GracefulShutdown(t *testing.T) {
}
}
// TestH1H2ConnectFailure tests that server handles the situation that
// connection attempt to HTTP/2 backend failed.
func
TestH1H2ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -150,6 +160,8 @@ func TestH1H2ConnectFailure(t *testing.T) {
}
}
// TestH1H2NoHost tests that server rejects request without Host
// header field for HTTP/2 backend.
func
TestH1H2NoHost
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
integration-tests/nghttpx_http2_test.go
View file @
0fcfe16d
...
...
@@ -11,6 +11,7 @@ import (
"testing"
)
// TestH1H2PlainGET tests whether simple HTTP/2 GET request works.
func
TestH2H1PlainGET
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -28,6 +29,8 @@ func TestH2H1PlainGET(t *testing.T) {
}
}
// TestH2H1AddXff tests that server generates X-Forwarded-For header
// field when forwarding request to backend.
func
TestH2H1AddXff
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
...
...
@@ -46,6 +49,8 @@ func TestH2H1AddXff(t *testing.T) {
}
}
// TestH2H1AddXff2 tests that server appends X-Forwarded-For header
// field to existing one when forwarding request to backend.
func
TestH2H1AddXff2
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
...
...
@@ -67,6 +72,8 @@ func TestH2H1AddXff2(t *testing.T) {
}
}
// TestH2H1StripXff tests that --strip-incoming-x-forwarded-for
// option.
func
TestH2H1StripXff
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--strip-incoming-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
xff
,
found
:=
r
.
Header
[
"X-Forwarded-For"
];
found
{
...
...
@@ -86,6 +93,8 @@ func TestH2H1StripXff(t *testing.T) {
}
}
// TestH2H1StripAddXff tests that --strip-incoming-x-forwarded-for and
// --add-x-forwarded-for options.
func
TestH2H1StripAddXff
(
t
*
testing
.
T
)
{
args
:=
[]
string
{
"--strip-incoming-x-forwarded-for"
,
...
...
@@ -111,6 +120,9 @@ func TestH2H1StripAddXff(t *testing.T) {
}
}
// TestH2H1BadRequestCL tests that server rejects request whose
// content-length header field value does not match its request body
// size.
func
TestH2H1BadRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -135,6 +147,9 @@ func TestH2H1BadRequestCL(t *testing.T) {
}
}
// TestH2H1BadResponseCL tests that server returns error when
// content-length response header field value does not match its
// response body size.
func
TestH2H1BadResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
// we set content-length: 1024, but only send 3 bytes.
...
...
@@ -156,6 +171,8 @@ func TestH2H1BadResponseCL(t *testing.T) {
}
}
// TestH2H1LocationRewrite tests location header field rewriting
// works.
func
TestH2H1LocationRewrite
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
// TODO we cannot get st.ts's port number here.. 8443
...
...
@@ -177,6 +194,7 @@ func TestH2H1LocationRewrite(t *testing.T) {
}
}
// TestH2H1ChunkedRequestBody tests that chunked request body works.
func
TestH2H1ChunkedRequestBody
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
want
:=
"[chunked]"
...
...
@@ -204,6 +222,8 @@ func TestH2H1ChunkedRequestBody(t *testing.T) {
}
}
// TestH2H1MultipleRequestCL tests that server rejects request with
// multiple Content-Length request header fields.
func
TestH2H1MultipleRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
@@ -226,6 +246,8 @@ func TestH2H1MultipleRequestCL(t *testing.T) {
}
}
// TestH2H1InvalidRequestCL tests that server rejects request with
// Content-Length which cannot be parsed as a number.
func
TestH2H1InvalidRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
@@ -247,6 +269,8 @@ func TestH2H1InvalidRequestCL(t *testing.T) {
}
}
// TestH2H1ConnectFailure tests that server handles the situation that
// connection attempt to HTTP/1 backend failed.
func
TestH2H1ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -266,6 +290,7 @@ func TestH2H1ConnectFailure(t *testing.T) {
}
}
// TestH2H1GracefulShutdown tests graceful shutdown.
func
TestH2H1GracefulShutdown
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -342,6 +367,8 @@ func TestH2H1GracefulShutdown(t *testing.T) {
}
}
// TestH2H2MultipleResponseCL tests that server returns error if
// multiple Content-Length response header fields are received.
func
TestH2H2MultipleResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
"1"
)
...
...
@@ -361,6 +388,9 @@ func TestH2H2MultipleResponseCL(t *testing.T) {
}
}
// TestH2H2InvalidResponseCL tests that server returns error if
// Content-Length response header field value cannot be parsed as a
// number.
func
TestH2H2InvalidResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
""
)
...
...
@@ -379,6 +409,8 @@ func TestH2H2InvalidResponseCL(t *testing.T) {
}
}
// TestH2H2ConnectFailure tests that server handles the situation that
// connection attempt to HTTP/2 backend failed.
func
TestH2H2ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
integration-tests/nghttpx_spdy_test.go
View file @
0fcfe16d
...
...
@@ -7,6 +7,7 @@ import (
"testing"
)
// TestS3H1PlainGET tests whether simple SPDY GET request works.
func
TestS3H1PlainGET
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--npn-list=spdy/3.1"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -24,6 +25,9 @@ func TestS3H1PlainGET(t *testing.T) {
}
}
// TestS3H1BadRequestCL tests that server rejects request whose
// content-length header field value does not match its request body
// size.
func
TestS3H1BadRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--npn-list=spdy/3.1"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
@@ -48,6 +52,8 @@ func TestS3H1BadRequestCL(t *testing.T) {
}
}
// TestS3H1MultipleRequestCL tests that server rejects request with
// multiple Content-Length request header fields.
func
TestS3H1MultipleRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--npn-list=spdy/3.1"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
@@ -70,6 +76,8 @@ func TestS3H1MultipleRequestCL(t *testing.T) {
}
}
// TestS3H1InvalidRequestCL tests that server rejects request with
// Content-Length which cannot be parsed as a number.
func
TestS3H1InvalidRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--npn-list=spdy/3.1"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t
.
Errorf
(
"server should not forward bad request"
)
...
...
@@ -91,6 +99,8 @@ func TestS3H1InvalidRequestCL(t *testing.T) {
}
}
// TestS3H2ConnectFailure tests that server handles the situation that
// connection attempt to HTTP/2 backend failed.
func
TestS3H2ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTesterTLS
([]
string
{
"--npn-list=spdy/3.1"
,
"--http2-bridge"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment