Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
275e978b
Commit
275e978b
authored
Oct 26, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16241 from smarterclayton/fix_flake_stream
Auto commit by PR queue bot
parents
33d948b5
f79c74e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
stream_test.go
pkg/util/wsstream/stream_test.go
+25
-22
No files found.
pkg/util/wsstream/stream_test.go
View file @
275e978b
...
@@ -110,28 +110,31 @@ func TestStreamSurvivesPanic(t *testing.T) {
...
@@ -110,28 +110,31 @@ func TestStreamSurvivesPanic(t *testing.T) {
}
}
func
TestStreamClosedDuringRead
(
t
*
testing
.
T
)
{
func
TestStreamClosedDuringRead
(
t
*
testing
.
T
)
{
ch
:=
make
(
chan
struct
{})
for
i
:=
0
;
i
<
25
;
i
++
{
input
:=
"some random text"
ch
:=
make
(
chan
struct
{})
errs
:=
&
errorReader
{
input
:=
"some random text"
reads
:
[][]
byte
{
errs
:=
&
errorReader
{
[]
byte
(
"some random"
),
reads
:
[][]
byte
{
[]
byte
(
" text"
),
[]
byte
(
"some random"
),
},
[]
byte
(
" text"
),
err
:
fmt
.
Errorf
(
"stuff"
),
},
pause
:
ch
,
err
:
fmt
.
Errorf
(
"stuff"
),
}
pause
:
ch
,
r
:=
NewReader
(
errs
,
false
)
}
r
:=
NewReader
(
errs
,
false
)
data
,
err
:=
readWebSocket
(
r
,
t
,
func
(
c
*
websocket
.
Conn
)
{
c
.
Close
()
data
,
err
:=
readWebSocket
(
r
,
t
,
func
(
c
*
websocket
.
Conn
)
{
time
.
Sleep
(
time
.
Millisecond
)
c
.
Close
()
close
(
ch
)
close
(
ch
)
})
})
if
!
reflect
.
DeepEqual
(
data
,
[]
byte
(
input
))
{
// verify that the data returned by the server on an early close always has a specific error
t
.
Errorf
(
"unexpected server read: %v"
,
data
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"use of closed network connection"
)
{
}
t
.
Fatal
(
err
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"use of closed network connection"
)
{
}
t
.
Fatal
(
err
)
// verify that the data returned is a strict subset of the input
if
!
bytes
.
HasPrefix
([]
byte
(
input
),
data
)
&&
len
(
data
)
!=
0
{
t
.
Fatalf
(
"unexpected server read: %q"
,
string
(
data
))
}
}
}
}
}
...
...
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