update thrift, opencensus, others (#893)

* update thrift, opencensus, others

* stats: update to opencensus 0.6.0 view api
This commit is contained in:
Reed Allman
2018-03-26 15:43:49 -07:00
committed by GitHub
parent 0ce5c4500b
commit 8af605cf3d
1266 changed files with 122191 additions and 28775 deletions

12
vendor/github.com/lib/pq/.travis.sh generated vendored
View File

@@ -71,12 +71,6 @@ postgresql_uninstall() {
}
megacheck_install() {
# Megacheck is Go 1.6+, so skip if Go 1.5.
if [[ "$(go version)" =~ "go1.5" ]]
then
echo "megacheck not supported, skipping installation"
return 0
fi
# Lock megacheck version at $MEGACHECK_VERSION to prevent spontaneous
# new error messages in old code.
go get -d honnef.co/go/tools/...
@@ -86,12 +80,6 @@ megacheck_install() {
}
golint_install() {
# Golint is Go 1.6+, so skip if Go 1.5.
if [[ "$(go version)" =~ "go1.5" ]]
then
echo "golint not supported, skipping installation"
return 0
fi
go get github.com/golang/lint/golint
}

15
vendor/github.com/lib/pq/.travis.yml generated vendored
View File

@@ -1,10 +1,9 @@
language: go
go:
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x
- master
sudo: true
@@ -15,7 +14,7 @@ env:
- PQGOSSLTESTS=1
- PQSSLCERTTEST_PATH=$PWD/certs
- PGHOST=127.0.0.1
- MEGACHECK_VERSION=2017.2.1
- MEGACHECK_VERSION=2017.2.2
matrix:
- PGVERSION=10
- PGVERSION=9.6
@@ -45,13 +44,7 @@ script:
- >
goimports -d -e $(find -name '*.go') | awk '{ print } END { exit NR == 0 ? 0 : 1 }'
- go vet ./...
# For compatibility with Go 1.5, launch only if megacheck is present.
- >
which megacheck > /dev/null && megacheck -go 1.5 ./...
|| echo 'megacheck is not supported, skipping check'
# For compatibility with Go 1.5, launch only if golint is present.
- >
which golint > /dev/null && golint ./...
|| echo 'golint is not supported, skipping check'
- megacheck -go 1.8 ./...
- golint ./...
- PQTEST_BINARY_PARAMETERS=no go test -race -v ./...
- PQTEST_BINARY_PARAMETERS=yes go test -race -v ./...

View File

@@ -5,6 +5,7 @@ package pq
import (
"bufio"
"bytes"
"context"
"database/sql"
"database/sql/driver"
"io"
@@ -156,7 +157,7 @@ func benchMockQuery(b *testing.B, c *conn, query string) {
b.Fatal(err)
}
defer stmt.Close()
rows, err := stmt.Query(nil)
rows, err := stmt.(driver.StmtQueryContext).QueryContext(context.Background(), nil)
if err != nil {
b.Fatal(err)
}
@@ -266,7 +267,7 @@ func BenchmarkMockPreparedSelectSeries(b *testing.B) {
}
func benchPreparedMockQuery(b *testing.B, c *conn, stmt driver.Stmt) {
rows, err := stmt.Query(nil)
rows, err := stmt.(driver.StmtQueryContext).QueryContext(context.Background(), nil)
if err != nil {
b.Fatal(err)
}

View File

@@ -1,6 +1,7 @@
package pq
import (
"context"
"database/sql"
"database/sql/driver"
"fmt"
@@ -1263,8 +1264,8 @@ func TestParseComplete(t *testing.T) {
// Test interface conformance.
var (
_ driver.Execer = (*conn)(nil)
_ driver.Queryer = (*conn)(nil)
_ driver.ExecerContext = (*conn)(nil)
_ driver.QueryerContext = (*conn)(nil)
)
func TestNullAfterNonNull(t *testing.T) {
@@ -1609,10 +1610,10 @@ func TestRowsResultTag(t *testing.T) {
t.Fatal(err)
}
defer conn.Close()
q := conn.(driver.Queryer)
q := conn.(driver.QueryerContext)
for _, test := range tests {
if rows, err := q.Query(test.query, nil); err != nil {
if rows, err := q.QueryContext(context.Background(), test.query, nil); err != nil {
t.Fatalf("%s: %s", test.query, err)
} else {
r := rows.(ResultTag)

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"database/sql"
"database/sql/driver"
"net"
"strings"
"testing"
)
@@ -400,15 +401,19 @@ func TestCopyRespLoopConnectionError(t *testing.T) {
if err == nil {
t.Fatalf("expected error")
}
pge, ok := err.(*Error)
if !ok {
switch pge := err.(type) {
case *Error:
if pge.Code.Name() != "admin_shutdown" {
t.Fatalf("expected admin_shutdown, got %s", pge.Code.Name())
}
case *net.OpError:
// ignore
default:
if err == driver.ErrBadConn {
// likely an EPIPE
} else {
t.Fatalf("expected *pq.Error or driver.ErrBadConn, got %+#v", err)
t.Fatalf("unexpected error, got %+#v", err)
}
} else if pge.Code.Name() != "admin_shutdown" {
t.Fatalf("expected admin_shutdown, got %s", pge.Code.Name())
}
_ = stmt.Close()

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"database/sql"
"fmt"
"strings"
"regexp"
"testing"
"time"
@@ -304,24 +304,27 @@ func TestInfinityTimestamp(t *testing.T) {
var err error
var resultT time.Time
expectedErrorStrPrefix := `sql: Scan error on column index 0: unsupported`
expectedErrorStrRegexp := regexp.MustCompile(
`^sql: Scan error on column index 0(, name "timestamp(tz)?"|): unsupported`)
type testCases []struct {
Query string
Param string
ExpectedErrStrPrefix string
ExpectedVal interface{}
Query string
Param string
ExpectedErrorStrRegexp *regexp.Regexp
ExpectedVal interface{}
}
tc := testCases{
{"SELECT $1::timestamp", "-infinity", expectedErrorStrPrefix, "-infinity"},
{"SELECT $1::timestamptz", "-infinity", expectedErrorStrPrefix, "-infinity"},
{"SELECT $1::timestamp", "infinity", expectedErrorStrPrefix, "infinity"},
{"SELECT $1::timestamptz", "infinity", expectedErrorStrPrefix, "infinity"},
{"SELECT $1::timestamp", "-infinity", expectedErrorStrRegexp, "-infinity"},
{"SELECT $1::timestamptz", "-infinity", expectedErrorStrRegexp, "-infinity"},
{"SELECT $1::timestamp", "infinity", expectedErrorStrRegexp, "infinity"},
{"SELECT $1::timestamptz", "infinity", expectedErrorStrRegexp, "infinity"},
}
// try to assert []byte to time.Time
for _, q := range tc {
err = db.QueryRow(q.Query, q.Param).Scan(&resultT)
if !strings.HasPrefix(err.Error(), q.ExpectedErrStrPrefix) {
t.Errorf("Scanning -/+infinity, expected error to have prefix %q, got %q", q.ExpectedErrStrPrefix, err)
if !q.ExpectedErrorStrRegexp.MatchString(err.Error()) {
t.Errorf("Scanning -/+infinity, expected error to match regexp %q, got %q",
q.ExpectedErrorStrRegexp, err)
}
}
// yield []byte

3
vendor/github.com/lib/pq/error.go generated vendored
View File

@@ -488,7 +488,8 @@ func (c *conn) errRecover(err *error) {
*err = v
}
case *net.OpError:
*err = driver.ErrBadConn
c.bad = true
*err = v
case error:
if v == io.EOF || v.(error).Error() == "remote error: handshake failure" {
*err = driver.ErrBadConn

View File

@@ -228,7 +228,9 @@ func TestContextCancelBegin(t *testing.T) {
cancel()
if err != nil {
t.Fatal(err)
} else if err := tx.Rollback(); err != nil && err != sql.ErrTxDone {
} else if err := tx.Rollback(); err != nil &&
err.Error() != "pq: canceling statement due to user request" &&
err != sql.ErrTxDone {
t.Fatal(err)
}
}()

2
vendor/github.com/lib/pq/notify.go generated vendored
View File

@@ -784,7 +784,7 @@ func (l *Listener) listenerConnLoop() {
}
l.emitEvent(ListenerEventDisconnected, err)
time.Sleep(nextReconnect.Sub(time.Now()))
time.Sleep(time.Until(nextReconnect))
}
}