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:
Alexander Neumann
2018-01-23 19:40:42 +01:00
parent b63de7c798
commit 2b39f9f4b2
3435 changed files with 1318042 additions and 315692 deletions

View File

@@ -15,11 +15,13 @@
package pubsub
import (
"fmt"
"net"
"reflect"
"testing"
"time"
"cloud.google.com/go/internal/testutil"
"golang.org/x/net/context"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
@@ -28,46 +30,18 @@ import (
"google.golang.org/grpc/codes"
)
type topicListService struct {
service
topics []string
err error
t *testing.T // for error logging.
}
func (s *topicListService) newNextStringFunc() nextStringFunc {
return func() (string, error) {
if len(s.topics) == 0 {
return "", iterator.Done
}
tn := s.topics[0]
s.topics = s.topics[1:]
return tn, s.err
}
}
func (s *topicListService) listProjectTopics(ctx context.Context, projName string) nextStringFunc {
if projName != "projects/projid" {
s.t.Fatalf("unexpected call: projName: %q", projName)
return nil
}
return s.newNextStringFunc()
}
func checkTopicListing(t *testing.T, want []string) {
s := &topicListService{topics: want, t: t}
c := &Client{projectID: "projid", s: s}
func checkTopicListing(t *testing.T, c *Client, want []string) {
topics, err := slurpTopics(c.Topics(context.Background()))
if err != nil {
t.Errorf("error listing topics: %v", err)
t.Fatalf("error listing topics: %v", err)
}
got := topicNames(topics)
if !reflect.DeepEqual(got, want) {
var got []string
for _, topic := range topics {
got = append(got, topic.ID())
}
if !testutil.Equal(got, want) {
t.Errorf("topic list: got: %v, want: %v", got, want)
}
if len(s.topics) != 0 {
t.Errorf("outstanding topics: %v", s.topics)
}
}
// All returns the remaining topics from this iterator.
@@ -87,38 +61,27 @@ func slurpTopics(it *TopicIterator) ([]*Topic, error) {
func TestTopicID(t *testing.T) {
const id = "id"
serv := &topicListService{
topics: []string{"projects/projid/topics/t1", "projects/projid/topics/t2"},
t: t,
}
c := &Client{projectID: "projid", s: serv}
c, _ := newFake(t)
s := c.Topic(id)
if got, want := s.ID(), id; got != want {
t.Errorf("Token.ID() = %q; want %q", got, want)
}
want := []string{"t1", "t2"}
topics, err := slurpTopics(c.Topics(context.Background()))
if err != nil {
t.Errorf("error listing topics: %v", err)
}
for i, topic := range topics {
if got, want := topic.ID(), want[i]; got != want {
t.Errorf("Token.ID() = %q; want %q", got, want)
}
}
}
func TestListTopics(t *testing.T) {
checkTopicListing(t, []string{
"projects/projid/topics/t1",
"projects/projid/topics/t2",
"projects/projid/topics/t3",
"projects/projid/topics/t4"})
c, _ := newFake(t)
var ids []string
for i := 1; i <= 4; i++ {
id := fmt.Sprintf("t%d", i)
ids = append(ids, id)
mustCreateTopic(t, c, id)
}
checkTopicListing(t, c, ids)
}
func TestListCompletelyEmptyTopics(t *testing.T) {
var want []string
checkTopicListing(t, want)
c, _ := newFake(t)
checkTopicListing(t, c, nil)
}
func TestStopPublishOrder(t *testing.T) {
@@ -148,11 +111,10 @@ func TestPublishTimeout(t *testing.T) {
if err != nil {
t.Fatal(err)
}
s, err := newPubSubService(context.Background(), []option.ClientOption{option.WithGRPCConn(conn)})
c, err := NewClient(ctx, "projectID", option.WithGRPCConn(conn))
if err != nil {
t.Fatal(err)
}
c := &Client{s: s}
topic := c.Topic("t")
topic.PublishSettings.Timeout = 3 * time.Second
r := topic.Publish(ctx, &Message{})
@@ -176,12 +138,10 @@ func (s *alwaysFailPublish) Publish(ctx context.Context, req *pubsubpb.PublishRe
return nil, grpc.Errorf(codes.Unavailable, "try again")
}
func topicNames(topics []*Topic) []string {
var names []string
for _, topic := range topics {
names = append(names, topic.name)
func mustCreateTopic(t *testing.T, c *Client, id string) *Topic {
topic, err := c.CreateTopic(context.Background(), id)
if err != nil {
t.Fatal(err)
}
return names
return topic
}