mirror of
https://github.com/restic/restic.git
synced 2025-08-25 12:18:18 +00:00
Update vendored dependencies
This includes github.com/kurin/blazer 0.2.0, which resolves #1291
This commit is contained in:
16
vendor/cloud.google.com/go/storage/writer_test.go
generated
vendored
16
vendor/cloud.google.com/go/storage/writer_test.go
generated
vendored
@@ -33,6 +33,7 @@ import (
|
||||
|
||||
type fakeTransport struct {
|
||||
gotReq *http.Request
|
||||
gotBody []byte
|
||||
results []transportResult
|
||||
}
|
||||
|
||||
@@ -47,6 +48,14 @@ func (t *fakeTransport) addResult(res *http.Response, err error) {
|
||||
|
||||
func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
t.gotReq = req
|
||||
t.gotBody = nil
|
||||
if req.Body != nil {
|
||||
bytes, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t.gotBody = bytes
|
||||
}
|
||||
if len(t.results) == 0 {
|
||||
return nil, fmt.Errorf("error handling request")
|
||||
}
|
||||
@@ -58,6 +67,7 @@ func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
func TestErrorOnObjectsInsertCall(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
const contents = "hello world"
|
||||
|
||||
doWrite := func(hc *http.Client) *Writer {
|
||||
client, err := NewClient(ctx, option.WithHTTPClient(hc))
|
||||
@@ -69,7 +79,7 @@ func TestErrorOnObjectsInsertCall(t *testing.T) {
|
||||
|
||||
// We can't check that the Write fails, since it depends on the write to the
|
||||
// underling fakeTransport failing which is racy.
|
||||
wc.Write([]byte("hello world"))
|
||||
wc.Write([]byte(contents))
|
||||
return wc
|
||||
}
|
||||
|
||||
@@ -94,6 +104,10 @@ func TestErrorOnObjectsInsertCall(t *testing.T) {
|
||||
if err := wc.Close(); err != nil {
|
||||
t.Errorf("got %v, want nil", err)
|
||||
}
|
||||
got := string(ft.gotBody)
|
||||
if !strings.Contains(got, contents) {
|
||||
t.Errorf("got body %q, which does not contain %q", got, contents)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncryption(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user