From 3aca4399c51a4fcd0875e7225ed1f8e9d29fde34 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 1 May 2018 12:31:33 -0700 Subject: [PATCH] internal: fix compilation errors in tests Not found earlier due to #1138 Change-Id: I1601554adb746f7b67cd361e8779d5092e8b3696 --- internal/amazon/s3/client_test.go | 5 +++-- internal/video/thumbnail/handler.go | 2 +- internal/video/thumbnail/handler_test.go | 3 ++- internal/video/thumbnail/service_test.go | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/amazon/s3/client_test.go b/internal/amazon/s3/client_test.go index 68f47a1a4..8627dbf46 100644 --- a/internal/amazon/s3/client_test.go +++ b/internal/amazon/s3/client_test.go @@ -18,6 +18,7 @@ package s3 import ( "bytes" + "context" "crypto/md5" "io" "net/http" @@ -62,7 +63,7 @@ func getTestClient(t *testing.T) { func TestBuckets(t *testing.T) { getTestClient(t) defer containerID.KillRemove(t) - _, err := tc.Buckets() + _, err := tc.Buckets(context.Background()) if err != nil { t.Fatal(err) } @@ -129,7 +130,7 @@ func TestPutObject(t *testing.T) { t.Fatal(err) } // TODO(mpl): figure how to make fake-s3 work with buckets. - if err = tc.PutObject("hello.txt", "", md5h, size, &buf); err != nil { + if err = tc.PutObject(context.Background(), "hello.txt", "", md5h, size, &buf); err != nil { t.Fatal(err) } // TODO(mpl): figure out why Stat of newly uploaded object does not match size from above. diff --git a/internal/video/thumbnail/handler.go b/internal/video/thumbnail/handler.go index 726e63fec..0a13ba0aa 100644 --- a/internal/video/thumbnail/handler.go +++ b/internal/video/thumbnail/handler.go @@ -62,7 +62,7 @@ func serveRef(rw http.ResponseWriter, req *http.Request, ref blob.Ref, fetcher b rw.Header().Set("Content-Type", "application/octet-stream") - fr, err := schema.NewFileReader(fetcher, ref) + fr, err := schema.NewFileReader(req.Context(), fetcher, ref) if err != nil { httputil.ServeError(rw, req, err) return diff --git a/internal/video/thumbnail/handler_test.go b/internal/video/thumbnail/handler_test.go index f7637b480..e819cc03f 100644 --- a/internal/video/thumbnail/handler_test.go +++ b/internal/video/thumbnail/handler_test.go @@ -17,6 +17,7 @@ limitations under the License. package thumbnail import ( + "context" "io/ioutil" "net/http" "net/http/httptest" @@ -46,7 +47,7 @@ func TestHandlerWrongRef(t *testing.T) { func TestHandlerRightRef(t *testing.T) { b := test.Blob{Contents: "Foo"} storage := new(test.Fetcher) - ref, err := schema.WriteFileFromReader(storage, "", b.Reader()) + ref, err := schema.WriteFileFromReader(context.Background(), storage, "", b.Reader()) if err != nil { t.Fatal(err) } diff --git a/internal/video/thumbnail/service_test.go b/internal/video/thumbnail/service_test.go index 105e1cbe3..3510dfbc9 100644 --- a/internal/video/thumbnail/service_test.go +++ b/internal/video/thumbnail/service_test.go @@ -18,6 +18,7 @@ package thumbnail import ( "bytes" + "context" "io/ioutil" "net/url" "os" @@ -40,7 +41,7 @@ func storageAndBlobRef(t *testing.T) (blobserver.Storage, blob.Ref) { if err != nil { t.Fatal(err) } - ref, err := schema.WriteFileFromReader(storage, "small.webm", inFile) + ref, err := schema.WriteFileFromReader(context.Background(), storage, "small.webm", inFile) if err != nil { t.Fatal(err) } @@ -49,7 +50,7 @@ func storageAndBlobRef(t *testing.T) (blobserver.Storage, blob.Ref) { func TestStorage(t *testing.T) { store, ref := storageAndBlobRef(t) - fr, err := schema.NewFileReader(store, ref) + fr, err := schema.NewFileReader(context.Background(), store, ref) if err != nil { t.Fatal(err) }