Commit ab25c40c authored by Yu-Ju Hong's avatar Yu-Ju Hong

Update the InputStream tests

parent 31d1607a
......@@ -412,7 +412,7 @@ func (obj *SimpleStream) DeepCopyObject() runtime.Object {
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.accept = accept
return s, false, s.contentType, s.err
......
......@@ -19,6 +19,7 @@ package rest
import (
"bufio"
"bytes"
"context"
"fmt"
"io/ioutil"
"net/http"
......@@ -45,7 +46,7 @@ func TestInputStreamReader(t *testing.T) {
streamer := &LocationStreamer{
Location: u,
}
readCloser, _, _, err := streamer.InputStream("", "")
readCloser, _, _, err := streamer.InputStream(context.Background(), "", "")
if err != nil {
t.Errorf("Unexpected error when getting stream: %v", err)
return
......@@ -61,7 +62,7 @@ func TestInputStreamNullLocation(t *testing.T) {
streamer := &LocationStreamer{
Location: nil,
}
readCloser, _, _, err := streamer.InputStream("", "")
readCloser, _, _, err := streamer.InputStream(context.Background(), "", "")
if err != nil {
t.Errorf("Unexpected error when getting stream with null location: %v", err)
}
......@@ -91,7 +92,7 @@ func TestInputStreamContentType(t *testing.T) {
Location: location,
Transport: fakeTransport("application/json", "hello world"),
}
readCloser, _, contentType, err := streamer.InputStream("", "")
readCloser, _, contentType, err := streamer.InputStream(context.Background(), "", "")
if err != nil {
t.Errorf("Unexpected error when getting stream: %v", err)
return
......@@ -109,7 +110,7 @@ func TestInputStreamTransport(t *testing.T) {
Location: location,
Transport: fakeTransport("text/plain", message),
}
readCloser, _, _, err := streamer.InputStream("", "")
readCloser, _, _, err := streamer.InputStream(context.Background(), "", "")
if err != nil {
t.Errorf("Unexpected error when getting stream: %v", err)
return
......@@ -136,7 +137,7 @@ func TestInputStreamInternalServerErrorTransport(t *testing.T) {
}
expectedError := errors.NewInternalError(fmt.Errorf("%s", message))
_, _, _, err := streamer.InputStream("", "")
_, _, _, err := streamer.InputStream(context.Background(), "", "")
if err == nil {
t.Errorf("unexpected non-error")
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment