Skip to content

Commit

Permalink
Merge branch 'master' into admin_client
Browse files Browse the repository at this point in the history
  • Loading branch information
hongalex committed Oct 22, 2020
2 parents d131d89 + 2894536 commit 6e94fb6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/version/version.go
Expand Up @@ -26,7 +26,7 @@ import (

// Repo is the current version of the client libraries in this
// repo. It should be a date in YYYYMMDD format.
const Repo = "20201019"
const Repo = "20201021"

// Go returns the Go runtime version. The returned string
// has no whitespace.
Expand Down
6 changes: 6 additions & 0 deletions pubsub/CHANGES.md
@@ -1,5 +1,11 @@
# Changes

## v1.8.2

- Fixes:
- fix(pubsub): track errors in published messages opencensus metric (#2970)
- fix(pubsub): do not propagate context deadline exceeded error (#3055)

## v1.8.1

- Suppress connection is closing on error on subscriber close. (#2951)
Expand Down
30 changes: 24 additions & 6 deletions spanner/spannertest/integration_test.go
Expand Up @@ -27,6 +27,7 @@ package spannertest
import (
"context"
"flag"
"fmt"
"reflect"
"sort"
"testing"
Expand Down Expand Up @@ -146,7 +147,9 @@ func TestIntegration_SpannerBasics(t *testing.T) {
if err != nil {
t.Fatalf("Dropping old index: %v", err)
}
dropTable(t, adminClient, tableName)
if err := dropTable(t, adminClient, tableName); err != nil {
t.Fatal(err)
}
err = updateDDL(t, adminClient,
`CREATE TABLE `+tableName+` (
FirstName STRING(20) NOT NULL,
Expand Down Expand Up @@ -404,14 +407,28 @@ func TestIntegration_ReadsAndQueries(t *testing.T) {
defer cancel()

// Drop any old tables.
// Do them all concurrently; this saves a lot of time.
allTables := []string{
"Staff",
"PlayerStats",
"JoinA", "JoinB", "JoinC", "JoinD", "JoinE", "JoinF",
"SomeStrings",
}
errc := make(chan error)
for _, table := range allTables {
dropTable(t, adminClient, table)
go func(table string) {
errc <- dropTable(t, adminClient, table)
}(table)
}
var bad bool
for range allTables {
if err := <-errc; err != nil {
t.Error(err)
bad = true
}
}
if bad {
t.FailNow()
}

err := updateDDL(t, adminClient,
Expand Down Expand Up @@ -861,8 +878,7 @@ func TestIntegration_ReadsAndQueries(t *testing.T) {
},
},
{
// TODO: This is broken against production; does not permit ORDER BY on something not grouped/aggregated.
`SELECT ARRAY_AGG(Cool) FROM Staff ORDER BY Name`,
`SELECT ARRAY_AGG(Cool) FROM Staff`,
nil,
[][]interface{}{
// Daniel, George (NULL), Jack (NULL), Sam, Teal'c
Expand Down Expand Up @@ -1011,6 +1027,7 @@ func TestIntegration_ReadsAndQueries(t *testing.T) {
}
var failures int
for _, test := range tests {
t.Logf("Testing query: %s", test.q)
stmt := spanner.NewStatement(test.q)
stmt.Params = test.params

Expand All @@ -1031,16 +1048,17 @@ func TestIntegration_ReadsAndQueries(t *testing.T) {
}
}

func dropTable(t *testing.T, adminClient *dbadmin.DatabaseAdminClient, table string) {
func dropTable(t *testing.T, adminClient *dbadmin.DatabaseAdminClient, table string) error {
t.Helper()
err := updateDDL(t, adminClient, "DROP TABLE "+table)
// NotFound is an acceptable failure mode here.
if st, _ := status.FromError(err); st.Code() == codes.NotFound {
err = nil
}
if err != nil {
t.Fatalf("Dropping old table %q: %v", table, err)
return fmt.Errorf("dropping old table %q: %v", table, err)
}
return nil
}

func updateDDL(t *testing.T, adminClient *dbadmin.DatabaseAdminClient, statements ...string) error {
Expand Down

0 comments on commit 6e94fb6

Please sign in to comment.