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
ab25c40c
Commit
ab25c40c
authored
Aug 13, 2018
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the InputStream tests
parent
31d1607a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
apiserver_test.go
staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go
+1
-1
streamer_test.go
...s.io/apiserver/pkg/registry/generic/rest/streamer_test.go
+6
-5
No files found.
staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go
View file @
ab25c40c
...
@@ -412,7 +412,7 @@ func (obj *SimpleStream) DeepCopyObject() runtime.Object {
...
@@ -412,7 +412,7 @@ func (obj *SimpleStream) DeepCopyObject() runtime.Object {
panic
(
"SimpleStream does not support DeepCopy"
)
panic
(
"SimpleStream does not support DeepCopy"
)
}
}
func
(
s
*
SimpleStream
)
InputStream
(
version
,
accept
string
)
(
io
.
ReadCloser
,
bool
,
string
,
error
)
{
func
(
s
*
SimpleStream
)
InputStream
(
_
context
.
Context
,
version
,
accept
string
)
(
io
.
ReadCloser
,
bool
,
string
,
error
)
{
s
.
version
=
version
s
.
version
=
version
s
.
accept
=
accept
s
.
accept
=
accept
return
s
,
false
,
s
.
contentType
,
s
.
err
return
s
,
false
,
s
.
contentType
,
s
.
err
...
...
staging/src/k8s.io/apiserver/pkg/registry/generic/rest/streamer_test.go
View file @
ab25c40c
...
@@ -19,6 +19,7 @@ package rest
...
@@ -19,6 +19,7 @@ package rest
import
(
import
(
"bufio"
"bufio"
"bytes"
"bytes"
"context"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
...
@@ -45,7 +46,7 @@ func TestInputStreamReader(t *testing.T) {
...
@@ -45,7 +46,7 @@ func TestInputStreamReader(t *testing.T) {
streamer
:=
&
LocationStreamer
{
streamer
:=
&
LocationStreamer
{
Location
:
u
,
Location
:
u
,
}
}
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
""
,
""
)
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
context
.
Background
(),
""
,
""
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
return
return
...
@@ -61,7 +62,7 @@ func TestInputStreamNullLocation(t *testing.T) {
...
@@ -61,7 +62,7 @@ func TestInputStreamNullLocation(t *testing.T) {
streamer
:=
&
LocationStreamer
{
streamer
:=
&
LocationStreamer
{
Location
:
nil
,
Location
:
nil
,
}
}
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
""
,
""
)
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
context
.
Background
(),
""
,
""
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error when getting stream with null location: %v"
,
err
)
t
.
Errorf
(
"Unexpected error when getting stream with null location: %v"
,
err
)
}
}
...
@@ -91,7 +92,7 @@ func TestInputStreamContentType(t *testing.T) {
...
@@ -91,7 +92,7 @@ func TestInputStreamContentType(t *testing.T) {
Location
:
location
,
Location
:
location
,
Transport
:
fakeTransport
(
"application/json"
,
"hello world"
),
Transport
:
fakeTransport
(
"application/json"
,
"hello world"
),
}
}
readCloser
,
_
,
contentType
,
err
:=
streamer
.
InputStream
(
""
,
""
)
readCloser
,
_
,
contentType
,
err
:=
streamer
.
InputStream
(
context
.
Background
(),
""
,
""
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
return
return
...
@@ -109,7 +110,7 @@ func TestInputStreamTransport(t *testing.T) {
...
@@ -109,7 +110,7 @@ func TestInputStreamTransport(t *testing.T) {
Location
:
location
,
Location
:
location
,
Transport
:
fakeTransport
(
"text/plain"
,
message
),
Transport
:
fakeTransport
(
"text/plain"
,
message
),
}
}
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
""
,
""
)
readCloser
,
_
,
_
,
err
:=
streamer
.
InputStream
(
context
.
Background
(),
""
,
""
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
t
.
Errorf
(
"Unexpected error when getting stream: %v"
,
err
)
return
return
...
@@ -136,7 +137,7 @@ func TestInputStreamInternalServerErrorTransport(t *testing.T) {
...
@@ -136,7 +137,7 @@ func TestInputStreamInternalServerErrorTransport(t *testing.T) {
}
}
expectedError
:=
errors
.
NewInternalError
(
fmt
.
Errorf
(
"%s"
,
message
))
expectedError
:=
errors
.
NewInternalError
(
fmt
.
Errorf
(
"%s"
,
message
))
_
,
_
,
_
,
err
:=
streamer
.
InputStream
(
""
,
""
)
_
,
_
,
_
,
err
:=
streamer
.
InputStream
(
context
.
Background
(),
""
,
""
)
if
err
==
nil
{
if
err
==
nil
{
t
.
Errorf
(
"unexpected non-error"
)
t
.
Errorf
(
"unexpected non-error"
)
return
return
...
...
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