Updating server dependancies. Also adding github.com/jaytaylor/html2text and gopkg.in/gomail.v2 (#5748)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3ada7a41a7
Коммит
c281ee3b61
108
vendor/github.com/lib/pq/conn_test.go
сгенерированный
поставляемый
108
vendor/github.com/lib/pq/conn_test.go
сгенерированный
поставляемый
@@ -191,7 +191,7 @@ localhost:*:*:*:pass_C
|
||||
pgpass.Close()
|
||||
|
||||
assertPassword := func(extra values, expected string) {
|
||||
o := &values{
|
||||
o := values{
|
||||
"host": "localhost",
|
||||
"sslmode": "disable",
|
||||
"connect_timeout": "20",
|
||||
@@ -203,11 +203,11 @@ localhost:*:*:*:pass_C
|
||||
"datestyle": "ISO, MDY",
|
||||
}
|
||||
for k, v := range extra {
|
||||
(*o)[k] = v
|
||||
o[k] = v
|
||||
}
|
||||
(&conn{}).handlePgpass(*o)
|
||||
if o.Get("password") != expected {
|
||||
t.Fatalf("For %v expected %s got %s", extra, expected, o.Get("password"))
|
||||
(&conn{}).handlePgpass(o)
|
||||
if pw := o["password"]; pw != expected {
|
||||
t.Fatalf("For %v expected %s got %s", extra, expected, pw)
|
||||
}
|
||||
}
|
||||
// wrong permissions for the pgpass file means it should be ignored
|
||||
@@ -686,17 +686,28 @@ func TestCloseBadConn(t *testing.T) {
|
||||
if err := cn.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// During the Go 1.9 cycle, https://github.com/golang/go/commit/3792db5
|
||||
// changed this error from
|
||||
//
|
||||
// net.errClosing = errors.New("use of closed network connection")
|
||||
//
|
||||
// to
|
||||
//
|
||||
// internal/poll.ErrClosing = errors.New("use of closed file or network connection")
|
||||
const errClosing = "use of closed"
|
||||
|
||||
// Verify write after closing fails.
|
||||
if _, err := nc.Write(nil); err == nil {
|
||||
t.Fatal("expected error")
|
||||
} else if !strings.Contains(err.Error(), "use of closed network connection") {
|
||||
t.Fatalf("expected use of closed network connection error, got %s", err)
|
||||
} else if !strings.Contains(err.Error(), errClosing) {
|
||||
t.Fatalf("expected %s error, got %s", errClosing, err)
|
||||
}
|
||||
// Verify second close fails.
|
||||
if err := cn.Close(); err == nil {
|
||||
t.Fatal("expected error")
|
||||
} else if !strings.Contains(err.Error(), "use of closed network connection") {
|
||||
t.Fatalf("expected use of closed network connection error, got %s", err)
|
||||
} else if !strings.Contains(err.Error(), errClosing) {
|
||||
t.Fatalf("expected %s error, got %s", errClosing, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,3 +1504,82 @@ func TestQuoteIdentifier(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRowsResultTag(t *testing.T) {
|
||||
type ResultTag interface {
|
||||
Result() driver.Result
|
||||
Tag() string
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
query string
|
||||
tag string
|
||||
ra int64
|
||||
}{
|
||||
{
|
||||
query: "CREATE TEMP TABLE temp (a int)",
|
||||
tag: "CREATE TABLE",
|
||||
},
|
||||
{
|
||||
query: "INSERT INTO temp VALUES (1), (2)",
|
||||
tag: "INSERT",
|
||||
ra: 2,
|
||||
},
|
||||
{
|
||||
query: "SELECT 1",
|
||||
},
|
||||
// A SELECT anywhere should take precedent.
|
||||
{
|
||||
query: "SELECT 1; INSERT INTO temp VALUES (1), (2)",
|
||||
},
|
||||
{
|
||||
query: "INSERT INTO temp VALUES (1), (2); SELECT 1",
|
||||
},
|
||||
// Multiple statements that don't return rows should return the last tag.
|
||||
{
|
||||
query: "CREATE TEMP TABLE t (a int); DROP TABLE t",
|
||||
tag: "DROP TABLE",
|
||||
},
|
||||
// Ensure a rows-returning query in any position among various tags-returing
|
||||
// statements will prefer the rows.
|
||||
{
|
||||
query: "SELECT 1; CREATE TEMP TABLE t (a int); DROP TABLE t",
|
||||
},
|
||||
{
|
||||
query: "CREATE TEMP TABLE t (a int); SELECT 1; DROP TABLE t",
|
||||
},
|
||||
{
|
||||
query: "CREATE TEMP TABLE t (a int); DROP TABLE t; SELECT 1",
|
||||
},
|
||||
// Verify that an no-results query doesn't set the tag.
|
||||
{
|
||||
query: "CREATE TEMP TABLE t (a int); SELECT 1 WHERE FALSE; DROP TABLE t;",
|
||||
},
|
||||
}
|
||||
|
||||
// If this is the only test run, this will correct the connection string.
|
||||
openTestConn(t).Close()
|
||||
|
||||
conn, err := Open("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
q := conn.(driver.Queryer)
|
||||
|
||||
for _, test := range tests {
|
||||
if rows, err := q.Query(test.query, nil); err != nil {
|
||||
t.Fatalf("%s: %s", test.query, err)
|
||||
} else {
|
||||
r := rows.(ResultTag)
|
||||
if tag := r.Tag(); tag != test.tag {
|
||||
t.Fatalf("%s: unexpected tag %q", test.query, tag)
|
||||
}
|
||||
res := r.Result()
|
||||
if ra, _ := res.RowsAffected(); ra != test.ra {
|
||||
t.Fatalf("%s: unexpected rows affected: %d", test.query, ra)
|
||||
}
|
||||
rows.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user