Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
9c8923f7
Commit
9c8923f7
authored
Feb 22, 2012
by
Brad Fitzpatrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/http: update test to use time.Duration better
R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/5688063
parent
31e94293
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
src/pkg/net/http/serve_test.go
src/pkg/net/http/serve_test.go
+2
-3
No files found.
src/pkg/net/http/serve_test.go
View file @
9c8923f7
...
...
@@ -245,8 +245,7 @@ func TestServerTimeouts(t *testing.T) {
fmt
.
Fprintf
(
res
,
"req=%d"
,
reqNum
)
})
const
second
=
1000000000
/* nanos */
server
:=
&
Server
{
Handler
:
handler
,
ReadTimeout
:
0.25
*
second
,
WriteTimeout
:
0.25
*
second
}
server
:=
&
Server
{
Handler
:
handler
,
ReadTimeout
:
250
*
time
.
Millisecond
,
WriteTimeout
:
250
*
time
.
Millisecond
}
go
server
.
Serve
(
l
)
url
:=
fmt
.
Sprintf
(
"http://%s/"
,
addr
)
...
...
@@ -277,7 +276,7 @@ func TestServerTimeouts(t *testing.T) {
if
n
!=
0
||
err
!=
io
.
EOF
{
t
.
Errorf
(
"Read = %v, %v, wanted %v, %v"
,
n
,
err
,
0
,
io
.
EOF
)
}
if
latency
<
200
*
time
.
Millisecond
/* fudge from
0.25
above */
{
if
latency
<
200
*
time
.
Millisecond
/* fudge from
250 ms
above */
{
t
.
Errorf
(
"got EOF after %s, want >= %s"
,
latency
,
200
*
time
.
Millisecond
)
}
...
...
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