mirror of
https://github.com/restic/restic.git
synced 2025-12-08 06:09:56 +00:00
Update dependencies
Among others, this updates minio-go, so that the new "eu-west-3" zone for AWS is supported.
This commit is contained in:
parent
b63de7c798
commit
2b39f9f4b2
3435 changed files with 1318042 additions and 315692 deletions
30
vendor/cloud.google.com/go/pubsub/streaming_pull_test.go
generated
vendored
30
vendor/cloud.google.com/go/pubsub/streaming_pull_test.go
generated
vendored
|
|
@ -20,14 +20,17 @@ package pubsub
|
|||
|
||||
import (
|
||||
"io"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/internal/testutil"
|
||||
|
||||
tspb "github.com/golang/protobuf/ptypes/timestamp"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
pb "google.golang.org/genproto/googleapis/pubsub/v1"
|
||||
|
|
@ -57,8 +60,18 @@ func TestStreamingPullMultipleFetches(t *testing.T) {
|
|||
testStreamingPullIteration(t, client, server, testMessages)
|
||||
}
|
||||
|
||||
func newTestSubscription(t *testing.T, client *Client, name string) *Subscription {
|
||||
topic := client.Topic("t")
|
||||
sub, err := client.CreateSubscription(context.Background(), name,
|
||||
SubscriptionConfig{Topic: topic})
|
||||
if err != nil {
|
||||
t.Fatalf("CreateSubscription: %v", err)
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
func testStreamingPullIteration(t *testing.T, client *Client, server *fakeServer, msgs []*pb.ReceivedMessage) {
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
gotMsgs, err := pullN(context.Background(), sub, len(msgs), func(_ context.Context, m *Message) {
|
||||
id, err := strconv.Atoi(m.ackID)
|
||||
if err != nil {
|
||||
|
|
@ -89,8 +102,7 @@ func testStreamingPullIteration(t *testing.T, client *Client, server *fakeServer
|
|||
t.Errorf("%d: no message for ackID %q", i, want.ackID)
|
||||
continue
|
||||
}
|
||||
got.doneFunc = nil // Don't compare done; it's a function.
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
if !testutil.Equal(got, want, cmp.AllowUnexported(Message{}), cmpopts.IgnoreTypes(func(string, bool) {})) {
|
||||
t.Errorf("%d: got\n%#v\nwant\n%#v", i, got, want)
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +128,7 @@ func TestStreamingPullError(t *testing.T) {
|
|||
client, server := newFake(t)
|
||||
server.addStreamingPullMessages(testMessages[:1])
|
||||
server.addStreamingPullError(grpc.Errorf(codes.Unknown, ""))
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
// Use only one goroutine, since the fake server is configured to
|
||||
// return only one error.
|
||||
sub.ReceiveSettings.NumGoroutines = 1
|
||||
|
|
@ -144,7 +156,7 @@ func TestStreamingPullCancel(t *testing.T) {
|
|||
// return and all messages have been acked.
|
||||
client, server := newFake(t)
|
||||
server.addStreamingPullMessages(testMessages)
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
var n int32
|
||||
err := sub.Receive(ctx, func(ctx2 context.Context, m *Message) {
|
||||
|
|
@ -179,7 +191,7 @@ func TestStreamingPullOneActive(t *testing.T) {
|
|||
// Only one call to Pull can be active at a time.
|
||||
client, srv := newFake(t)
|
||||
srv.addStreamingPullMessages(testMessages[:1])
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
err := sub.Receive(ctx, func(ctx context.Context, m *Message) {
|
||||
m.Ack()
|
||||
|
|
@ -209,7 +221,7 @@ func TestStreamingPullConcurrent(t *testing.T) {
|
|||
for i := 0; i < nMessages; i += 2 {
|
||||
server.addStreamingPullMessages([]*pb.ReceivedMessage{newMsg(i), newMsg(i + 1)})
|
||||
}
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Second)
|
||||
gotMsgs, err := pullN(ctx, sub, nMessages, func(ctx context.Context, m *Message) {
|
||||
m.Ack()
|
||||
|
|
@ -233,7 +245,7 @@ func TestStreamingPullFlowControl(t *testing.T) {
|
|||
// Callback invocations should not occur if flow control limits are exceeded.
|
||||
client, server := newFake(t)
|
||||
server.addStreamingPullMessages(testMessages)
|
||||
sub := client.Subscription("s")
|
||||
sub := newTestSubscription(t, client, "s")
|
||||
sub.ReceiveSettings.MaxOutstandingMessages = 2
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
activec := make(chan int)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue