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
ae1aac26
Commit
ae1aac26
authored
Jan 20, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integration: Set test naming convention
parent
8eb21608
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
integration-tests/nghttpx_test.go
integration-tests/nghttpx_test.go
+26
-26
No files found.
integration-tests/nghttpx_test.go
View file @
ae1aac26
...
@@ -9,12 +9,12 @@ import (
...
@@ -9,12 +9,12 @@ import (
"testing"
"testing"
)
)
func
TestPlainGET
(
t
*
testing
.
T
)
{
func
Test
H2H1
PlainGET
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestPlainGet"
,
name
:
"Test
H2H1
PlainGet"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
...
@@ -26,7 +26,7 @@ func TestPlainGET(t *testing.T) {
...
@@ -26,7 +26,7 @@ func TestPlainGET(t *testing.T) {
}
}
}
}
func
TestAddXff
(
t
*
testing
.
T
)
{
func
Test
H2H1
AddXff
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
want
:=
"127.0.0.1"
want
:=
"127.0.0.1"
...
@@ -37,14 +37,14 @@ func TestAddXff(t *testing.T) {
...
@@ -37,14 +37,14 @@ func TestAddXff(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
_
,
err
:=
st
.
http2
(
requestParam
{
_
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestAddXff"
,
name
:
"Test
H2H1
AddXff"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
}
}
}
}
func
TestAddXff2
(
t
*
testing
.
T
)
{
func
Test
H2H1
AddXff2
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
([]
string
{
"--add-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
xff
:=
r
.
Header
.
Get
(
"X-Forwarded-For"
)
want
:=
"host, 127.0.0.1"
want
:=
"host, 127.0.0.1"
...
@@ -55,7 +55,7 @@ func TestAddXff2(t *testing.T) {
...
@@ -55,7 +55,7 @@ func TestAddXff2(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
_
,
err
:=
st
.
http2
(
requestParam
{
_
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestAddXff2"
,
name
:
"Test
H2H1
AddXff2"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"x-forwarded-for"
,
"host"
),
pair
(
"x-forwarded-for"
,
"host"
),
},
},
...
@@ -65,7 +65,7 @@ func TestAddXff2(t *testing.T) {
...
@@ -65,7 +65,7 @@ func TestAddXff2(t *testing.T) {
}
}
}
}
func
TestStripXff
(
t
*
testing
.
T
)
{
func
Test
H2H1
StripXff
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--strip-incoming-x-forwarded-for"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
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
{
if
xff
,
found
:=
r
.
Header
[
"X-Forwarded-For"
];
found
{
t
.
Errorf
(
"X-Forwarded-For = %v; want nothing"
,
xff
)
t
.
Errorf
(
"X-Forwarded-For = %v; want nothing"
,
xff
)
...
@@ -74,7 +74,7 @@ func TestStripXff(t *testing.T) {
...
@@ -74,7 +74,7 @@ func TestStripXff(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
_
,
err
:=
st
.
http2
(
requestParam
{
_
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestStripXff1"
,
name
:
"Test
H2H1
StripXff1"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"x-forwarded-for"
,
"host"
),
pair
(
"x-forwarded-for"
,
"host"
),
},
},
...
@@ -84,7 +84,7 @@ func TestStripXff(t *testing.T) {
...
@@ -84,7 +84,7 @@ func TestStripXff(t *testing.T) {
}
}
}
}
func
TestStripAddXff
(
t
*
testing
.
T
)
{
func
Test
H2H1
StripAddXff
(
t
*
testing
.
T
)
{
args
:=
[]
string
{
args
:=
[]
string
{
"--strip-incoming-x-forwarded-for"
,
"--strip-incoming-x-forwarded-for"
,
"--add-x-forwarded-for"
,
"--add-x-forwarded-for"
,
...
@@ -99,7 +99,7 @@ func TestStripAddXff(t *testing.T) {
...
@@ -99,7 +99,7 @@ func TestStripAddXff(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
_
,
err
:=
st
.
http2
(
requestParam
{
_
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestStripAddXff"
,
name
:
"Test
H2H1
StripAddXff"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"x-forwarded-for"
,
"host"
),
pair
(
"x-forwarded-for"
,
"host"
),
},
},
...
@@ -109,14 +109,14 @@ func TestStripAddXff(t *testing.T) {
...
@@ -109,14 +109,14 @@ func TestStripAddXff(t *testing.T) {
}
}
}
}
func
TestH
TTP2
BadRequestCL
(
t
*
testing
.
T
)
{
func
TestH
2H1
BadRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
defer
st
.
Close
()
// we set content-length: 1024, but the actual request body is
// we set content-length: 1024, but the actual request body is
// 3 bytes.
// 3 bytes.
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
BadRequestCL"
,
name
:
"TestH
2H1
BadRequestCL"
,
method
:
"POST"
,
method
:
"POST"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"content-length"
,
"1024"
),
pair
(
"content-length"
,
"1024"
),
...
@@ -133,7 +133,7 @@ func TestHTTP2BadRequestCL(t *testing.T) {
...
@@ -133,7 +133,7 @@ func TestHTTP2BadRequestCL(t *testing.T) {
}
}
}
}
func
TestH
TTP2
BadResponseCL
(
t
*
testing
.
T
)
{
func
TestH
2H1
BadResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
// we set content-length: 1024, but only send 3 bytes.
// we set content-length: 1024, but only send 3 bytes.
w
.
Header
()
.
Add
(
"Content-Length"
,
"1024"
)
w
.
Header
()
.
Add
(
"Content-Length"
,
"1024"
)
...
@@ -142,7 +142,7 @@ func TestHTTP2BadResponseCL(t *testing.T) {
...
@@ -142,7 +142,7 @@ func TestHTTP2BadResponseCL(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
BadResponseCL"
,
name
:
"TestH
2H1
BadResponseCL"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
...
@@ -154,7 +154,7 @@ func TestHTTP2BadResponseCL(t *testing.T) {
...
@@ -154,7 +154,7 @@ func TestHTTP2BadResponseCL(t *testing.T) {
}
}
}
}
func
TestH
TTP2
LocationRewrite
(
t
*
testing
.
T
)
{
func
TestH
2H1
LocationRewrite
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
// TODO we cannot get st.ts's port number here.. 8443
// TODO we cannot get st.ts's port number here.. 8443
// is just a place holder. We ignore it on rewrite.
// is just a place holder. We ignore it on rewrite.
...
@@ -163,7 +163,7 @@ func TestHTTP2LocationRewrite(t *testing.T) {
...
@@ -163,7 +163,7 @@ func TestHTTP2LocationRewrite(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
LocationRewrite"
,
name
:
"TestH
2H1
LocationRewrite"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
...
@@ -175,7 +175,7 @@ func TestHTTP2LocationRewrite(t *testing.T) {
...
@@ -175,7 +175,7 @@ func TestHTTP2LocationRewrite(t *testing.T) {
}
}
}
}
func
TestH
TTP2
ChunkedRequestBody
(
t
*
testing
.
T
)
{
func
TestH
2H1
ChunkedRequestBody
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
(
nil
,
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
want
:=
"[chunked]"
want
:=
"[chunked]"
if
got
:=
fmt
.
Sprint
(
r
.
TransferEncoding
);
got
!=
want
{
if
got
:=
fmt
.
Sprint
(
r
.
TransferEncoding
);
got
!=
want
{
...
@@ -193,7 +193,7 @@ func TestHTTP2ChunkedRequestBody(t *testing.T) {
...
@@ -193,7 +193,7 @@ func TestHTTP2ChunkedRequestBody(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
_
,
err
:=
st
.
http2
(
requestParam
{
_
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
ChunkedRequestBody"
,
name
:
"TestH
2H1
ChunkedRequestBody"
,
method
:
"POST"
,
method
:
"POST"
,
body
:
[]
byte
(
"foo"
),
body
:
[]
byte
(
"foo"
),
})
})
...
@@ -202,12 +202,12 @@ func TestHTTP2ChunkedRequestBody(t *testing.T) {
...
@@ -202,12 +202,12 @@ func TestHTTP2ChunkedRequestBody(t *testing.T) {
}
}
}
}
func
TestH
TTP2
DuplicateRequestCL
(
t
*
testing
.
T
)
{
func
TestH
2H1
DuplicateRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
DuplicateRequestCL"
,
name
:
"TestH
2H1
DuplicateRequestCL"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"content-length"
,
"1"
),
pair
(
"content-length"
,
"1"
),
pair
(
"content-length"
,
"2"
),
pair
(
"content-length"
,
"2"
),
...
@@ -222,12 +222,12 @@ func TestHTTP2DuplicateRequestCL(t *testing.T) {
...
@@ -222,12 +222,12 @@ func TestHTTP2DuplicateRequestCL(t *testing.T) {
}
}
}
}
func
TestH
TTP2
InvalidRequestCL
(
t
*
testing
.
T
)
{
func
TestH
2H1
InvalidRequestCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP2
InvalidRequestCL"
,
name
:
"TestH
2H1
InvalidRequestCL"
,
header
:
[]
hpack
.
HeaderField
{
header
:
[]
hpack
.
HeaderField
{
pair
(
"content-length"
,
""
),
pair
(
"content-length"
,
""
),
},
},
...
@@ -241,7 +241,7 @@ func TestHTTP2InvalidRequestCL(t *testing.T) {
...
@@ -241,7 +241,7 @@ func TestHTTP2InvalidRequestCL(t *testing.T) {
}
}
}
}
func
TestH
TTP
2DuplicateResponseCL
(
t
*
testing
.
T
)
{
func
TestH
2H
2DuplicateResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
"1"
)
w
.
Header
()
.
Add
(
"content-length"
,
"1"
)
w
.
Header
()
.
Add
(
"content-length"
,
"2"
)
w
.
Header
()
.
Add
(
"content-length"
,
"2"
)
...
@@ -249,7 +249,7 @@ func TestHTTP2DuplicateResponseCL(t *testing.T) {
...
@@ -249,7 +249,7 @@ func TestHTTP2DuplicateResponseCL(t *testing.T) {
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP
2DuplicateResponseCL"
,
name
:
"TestH
2H
2DuplicateResponseCL"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
...
@@ -260,14 +260,14 @@ func TestHTTP2DuplicateResponseCL(t *testing.T) {
...
@@ -260,14 +260,14 @@ func TestHTTP2DuplicateResponseCL(t *testing.T) {
}
}
}
}
func
TestH
TTP
2InvalidResponseCL
(
t
*
testing
.
T
)
{
func
TestH
2H
2InvalidResponseCL
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Add
(
"content-length"
,
""
)
w
.
Header
()
.
Add
(
"content-length"
,
""
)
})
})
defer
st
.
Close
()
defer
st
.
Close
()
res
,
err
:=
st
.
http2
(
requestParam
{
res
,
err
:=
st
.
http2
(
requestParam
{
name
:
"TestH
TTP
2InvalidResponseCL"
,
name
:
"TestH
2H
2InvalidResponseCL"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
t
.
Errorf
(
"Error st.http2() = %v"
,
err
)
...
...
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