mirror of https://github.com/perkeep/perkeep.git
internal: fix compilation errors in tests
Not found earlier due to #1138 Change-Id: I1601554adb746f7b67cd361e8779d5092e8b3696
This commit is contained in:
parent
5cee661fb0
commit
3aca4399c5
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue