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 committed 2018-01-23 19:40:42 +01:00
1 parent b63de7c798
commit 2b39f9f4b2
3435 files changed
+1317989 -315639

No files matched your search

+52 -39
View File
@@ -18,7 +18,6 @@ package spanner
import (
"errors"
"reflect"
"sync"
"testing"
"time"
@@ -60,12 +59,12 @@ func TestReadOnlyAcquire(t *testing.T) {
t.Parallel()
_, mc, client := mockClient(t)
defer client.Close()
acts := []testutil.Action{
testutil.NewAction("Begin", errUsr),
testutil.NewAction("Begin", nil),
testutil.NewAction("Begin", nil),
}
mc.SetActions(acts...)
mc.SetActions(
testutil.Action{"BeginTransaction", errUsr},
testutil.Action{"BeginTransaction", nil},
testutil.Action{"BeginTransaction", nil},
)
// Singleuse should only be used once.
txn := client.Single()
defer txn.Close()
@@ -74,13 +73,13 @@ func TestReadOnlyAcquire(t *testing.T) {
t.Errorf("Acquire for single use, got %v, want nil.", e)
}
_, _, e = txn.acquire(context.Background())
if wantErr := errTxClosed(); !reflect.DeepEqual(e, wantErr) {
if wantErr := errTxClosed(); !testEqual(e, wantErr) {
t.Errorf("Second acquire for single use, got %v, want %v.", e, wantErr)
}
// Multiuse can recover from acquire failure.
txn = client.ReadOnlyTransaction()
_, _, e = txn.acquire(context.Background())
if wantErr := toSpannerError(errUsr); !reflect.DeepEqual(e, wantErr) {
if wantErr := toSpannerError(errUsr); !testEqual(e, wantErr) {
t.Errorf("Acquire for multi use, got %v, want %v.", e, wantErr)
}
_, _, e = txn.acquire(context.Background())
@@ -90,7 +89,7 @@ func TestReadOnlyAcquire(t *testing.T) {
txn.Close()
// Multiuse can not be used after close.
_, _, e = txn.acquire(context.Background())
if wantErr := errTxClosed(); !reflect.DeepEqual(e, wantErr) {
if wantErr := errTxClosed(); !testEqual(e, wantErr) {
t.Errorf("Second acquire for multi use, got %v, want %v.", e, wantErr)
}
// Multiuse can be acquired concurrently.
@@ -118,10 +117,10 @@ func TestReadOnlyAcquire(t *testing.T) {
<-time.After(100 * time.Millisecond)
mc.Unfreeze()
wg.Wait()
if !reflect.DeepEqual(sh1, sh2) {
if !testEqual(sh1.session, sh2.session) {
t.Errorf("Expect acquire to get same session handle, got %v and %v.", sh1, sh2)
}
if !reflect.DeepEqual(ts1, ts2) {
if !testEqual(ts1, ts2) {
t.Errorf("Expect acquire to get same transaction selector, got %v and %v.", ts1, ts2)
}
}
@@ -132,11 +131,11 @@ func TestRetryOnAbort(t *testing.T) {
_, mc, client := mockClient(t)
defer client.Close()
// commit in writeOnlyTransaction
acts := []testutil.Action{
testutil.NewAction("Commit", errAbrt), // abort on first commit
testutil.NewAction("Commit", nil),
}
mc.SetActions(acts...)
mc.SetActions(
testutil.Action{"Commit", errAbrt}, // abort on first commit
testutil.Action{"Commit", nil},
)
ms := []*Mutation{
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}),
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}),
@@ -145,14 +144,14 @@ func TestRetryOnAbort(t *testing.T) {
t.Errorf("applyAtLeastOnce retry on abort, got %v, want nil.", e)
}
// begin and commit in ReadWriteTransaction
acts = []testutil.Action{
testutil.NewAction("Begin", nil), // let takeWriteSession succeed and get a session handle
testutil.NewAction("Commit", errAbrt), // let first commit fail and retry will begin new transaction
testutil.NewAction("Begin", errAbrt), // this time we can fail the begin attempt
testutil.NewAction("Begin", nil),
testutil.NewAction("Commit", nil),
}
mc.SetActions(acts...)
mc.SetActions(
testutil.Action{"BeginTransaction", nil}, // let takeWriteSession succeed and get a session handle
testutil.Action{"Commit", errAbrt}, // let first commit fail and retry will begin new transaction
testutil.Action{"BeginTransaction", errAbrt}, // this time we can fail the begin attempt
testutil.Action{"BeginTransaction", nil},
testutil.Action{"Commit", nil},
)
if _, e := client.Apply(context.Background(), ms); e != nil {
t.Errorf("ReadWriteTransaction retry on abort, got %v, want nil.", e)
}
@@ -176,22 +175,21 @@ func TestBadSession(t *testing.T) {
wantErr := spannerErrorf(codes.NotFound, "Session not found: %v", sid)
// ReadOnlyTransaction
acts := []testutil.Action{
testutil.NewAction("Begin", wantErr),
testutil.NewAction("Begin", wantErr),
testutil.NewAction("Begin", wantErr),
}
mc.SetActions(acts...)
mc.SetActions(
testutil.Action{"BeginTransaction", wantErr},
testutil.Action{"BeginTransaction", wantErr},
testutil.Action{"BeginTransaction", wantErr},
)
txn := client.ReadOnlyTransaction()
defer txn.Close()
if _, _, got := txn.acquire(ctx); !reflect.DeepEqual(wantErr, got) {
if _, _, got := txn.acquire(ctx); !testEqual(wantErr, got) {
t.Errorf("Expect acquire to fail, got %v, want %v.", got, wantErr)
}
// The failure should recycle the session, we expect it to be used in following requests.
if got := txn.Query(ctx, NewStatement("SELECT 1")); !reflect.DeepEqual(wantErr, got.err) {
if got := txn.Query(ctx, NewStatement("SELECT 1")); !testEqual(wantErr, got.err) {
t.Errorf("Expect Query to fail, got %v, want %v.", got.err, wantErr)
}
if got := txn.Read(ctx, "Users", KeySets(Key{"alice"}, Key{"bob"}), []string{"name", "email"}); !reflect.DeepEqual(wantErr, got.err) {
if got := txn.Read(ctx, "Users", KeySets(Key{"alice"}, Key{"bob"}), []string{"name", "email"}); !testEqual(wantErr, got.err) {
t.Errorf("Expect Read to fail, got %v, want %v.", got.err, wantErr)
}
// writeOnlyTransaction
@@ -199,11 +197,26 @@ func TestBadSession(t *testing.T) {
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}),
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}),
}
acts = []testutil.Action{
testutil.NewAction("Commit", wantErr),
}
mc.SetActions(acts...)
if _, got := client.Apply(context.Background(), ms, ApplyAtLeastOnce()); !reflect.DeepEqual(wantErr, got) {
mc.SetActions(testutil.Action{"Commit", wantErr})
if _, got := client.Apply(context.Background(), ms, ApplyAtLeastOnce()); !testEqual(wantErr, got) {
t.Errorf("Expect applyAtLeastOnce to fail, got %v, want %v.", got, wantErr)
}
}
func TestFunctionErrorReturned(t *testing.T) {
t.Parallel()
_, mc, client := mockClient(t)
defer client.Close()
mc.SetActions(
testutil.Action{"BeginTransaction", nil},
testutil.Action{"Rollback", nil},
)
want := errors.New("an error")
_, got := client.ReadWriteTransaction(context.Background(),
func(context.Context, *ReadWriteTransaction) error { return want })
if got != want {
t.Errorf("got <%v>, want <%v>", got, want)
}
mc.CheckActionsConsumed()
}