mirror of https://github.com/jackc/pgx.git
Remove github.com/Masterminds/semver/v3 test dependency
parent
1b416b36dc
commit
9ab821620f
1
go.mod
1
go.mod
|
@ -3,7 +3,6 @@ module github.com/jackc/pgx/v5
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver/v3 v3.1.1
|
|
||||||
github.com/go-kit/log v0.1.0
|
github.com/go-kit/log v0.1.0
|
||||||
github.com/gofrs/uuid v4.0.0+incompatible
|
github.com/gofrs/uuid v4.0.0+incompatible
|
||||||
github.com/jackc/chunkreader/v2 v2.0.1
|
github.com/jackc/chunkreader/v2 v2.0.1
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -1,7 +1,5 @@
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
|
||||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
|
|
|
@ -9,10 +9,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/semver/v3"
|
|
||||||
"github.com/jackc/pgx/v5"
|
"github.com/jackc/pgx/v5"
|
||||||
"github.com/jackc/pgx/v5/pgconn"
|
"github.com/jackc/pgx/v5/pgconn"
|
||||||
"github.com/jackc/pgx/v5/stdlib"
|
"github.com/jackc/pgx/v5/stdlib"
|
||||||
|
@ -46,7 +46,7 @@ func skipCockroachDB(t testing.TB, db *sql.DB, msg string) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func skipPostgreSQLVersion(t testing.TB, db *sql.DB, constraintStr, msg string) {
|
func skipPostgreSQLVersionLessThan(t testing.TB, db *sql.DB, minVersion int64) {
|
||||||
conn, err := db.Conn(context.Background())
|
conn, err := db.Conn(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
@ -54,25 +54,21 @@ func skipPostgreSQLVersion(t testing.TB, db *sql.DB, constraintStr, msg string)
|
||||||
err = conn.Raw(func(driverConn interface{}) error {
|
err = conn.Raw(func(driverConn interface{}) error {
|
||||||
conn := driverConn.(*stdlib.Conn).Conn()
|
conn := driverConn.(*stdlib.Conn).Conn()
|
||||||
serverVersionStr := conn.PgConn().ParameterStatus("server_version")
|
serverVersionStr := conn.PgConn().ParameterStatus("server_version")
|
||||||
serverVersionStr = regexp.MustCompile(`^[0-9.]+`).FindString(serverVersionStr)
|
serverVersionStr = regexp.MustCompile(`^[0-9]+`).FindString(serverVersionStr)
|
||||||
// if not PostgreSQL do nothing
|
// if not PostgreSQL do nothing
|
||||||
if serverVersionStr == "" {
|
if serverVersionStr == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
serverVersion, err := semver.NewVersion(serverVersionStr)
|
serverVersion, err := strconv.ParseInt(serverVersionStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := semver.NewConstraint(constraintStr)
|
if serverVersion < minVersion {
|
||||||
if err != nil {
|
t.Skipf("Test requires PostgreSQL v%d+", minVersion)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Check(serverVersion) {
|
|
||||||
t.Skip(msg)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1093,7 +1089,7 @@ func TestRegisterConnConfig(t *testing.T) {
|
||||||
// https://github.com/jackc/pgx/issues/958
|
// https://github.com/jackc/pgx/issues/958
|
||||||
func TestConnQueryRowConstraintErrors(t *testing.T) {
|
func TestConnQueryRowConstraintErrors(t *testing.T) {
|
||||||
testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, db *sql.DB) {
|
testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, db *sql.DB) {
|
||||||
skipPostgreSQLVersion(t, db, "< 11", "Test requires PG 11+")
|
skipPostgreSQLVersionLessThan(t, db, 11)
|
||||||
skipCockroachDB(t, db, "Server does not support deferred constraint (https://github.com/cockroachdb/cockroach/issues/31632)")
|
skipCockroachDB(t, db, "Server does not support deferred constraint (https://github.com/cockroachdb/cockroach/issues/31632)")
|
||||||
|
|
||||||
_, err := db.Exec(`create temporary table defer_test (
|
_, err := db.Exec(`create temporary table defer_test (
|
||||||
|
|
Loading…
Reference in New Issue