internal: fix compilation errors in tests

Not found earlier due to #1138

Change-Id: I1601554adb746f7b67cd361e8779d5092e8b3696
This commit is contained in:
Brad Fitzpatrick 2018-05-01 12:31:33 -07:00
parent 5cee661fb0
commit 3aca4399c5
4 changed files with 9 additions and 6 deletions

View File

@ -18,6 +18,7 @@ package s3
import ( import (
"bytes" "bytes"
"context"
"crypto/md5" "crypto/md5"
"io" "io"
"net/http" "net/http"
@ -62,7 +63,7 @@ func getTestClient(t *testing.T) {
func TestBuckets(t *testing.T) { func TestBuckets(t *testing.T) {
getTestClient(t) getTestClient(t)
defer containerID.KillRemove(t) defer containerID.KillRemove(t)
_, err := tc.Buckets() _, err := tc.Buckets(context.Background())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -129,7 +130,7 @@ func TestPutObject(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// TODO(mpl): figure how to make fake-s3 work with buckets. // 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) t.Fatal(err)
} }
// TODO(mpl): figure out why Stat of newly uploaded object does not match size from above. // TODO(mpl): figure out why Stat of newly uploaded object does not match size from above.

View File

@ -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") 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 { if err != nil {
httputil.ServeError(rw, req, err) httputil.ServeError(rw, req, err)
return return

View File

@ -17,6 +17,7 @@ limitations under the License.
package thumbnail package thumbnail
import ( import (
"context"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
@ -46,7 +47,7 @@ func TestHandlerWrongRef(t *testing.T) {
func TestHandlerRightRef(t *testing.T) { func TestHandlerRightRef(t *testing.T) {
b := test.Blob{Contents: "Foo"} b := test.Blob{Contents: "Foo"}
storage := new(test.Fetcher) storage := new(test.Fetcher)
ref, err := schema.WriteFileFromReader(storage, "", b.Reader()) ref, err := schema.WriteFileFromReader(context.Background(), storage, "", b.Reader())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -18,6 +18,7 @@ package thumbnail
import ( import (
"bytes" "bytes"
"context"
"io/ioutil" "io/ioutil"
"net/url" "net/url"
"os" "os"
@ -40,7 +41,7 @@ func storageAndBlobRef(t *testing.T) (blobserver.Storage, blob.Ref) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
ref, err := schema.WriteFileFromReader(storage, "small.webm", inFile) ref, err := schema.WriteFileFromReader(context.Background(), storage, "small.webm", inFile)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -49,7 +50,7 @@ func storageAndBlobRef(t *testing.T) (blobserver.Storage, blob.Ref) {
func TestStorage(t *testing.T) { func TestStorage(t *testing.T) {
store, ref := storageAndBlobRef(t) store, ref := storageAndBlobRef(t)
fr, err := schema.NewFileReader(store, ref) fr, err := schema.NewFileReader(context.Background(), store, ref)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }