Skip test based on missing line type

Instead of explicit server version checking. Ubuntu installed version
string is not parsable by go-version. e.g.

10.2 (Ubuntu 10.2-1.pgdg16.04+1)
pull/400/head
Jack Christensen 2018-02-16 21:37:41 -06:00
parent 606697ffdf
commit 55ca9db5d5
1 changed files with 2 additions and 11 deletions

View File

@ -3,23 +3,14 @@ package pgtype_test
import (
"testing"
version "github.com/hashicorp/go-version"
"github.com/jackc/pgx/pgtype"
"github.com/jackc/pgx/pgtype/testutil"
)
func TestLineTranscode(t *testing.T) {
conn := testutil.MustConnectPgx(t)
serverVersion, err := version.NewVersion(conn.RuntimeParams["server_version"])
if err != nil {
t.Fatalf("cannot get server version: %v", err)
}
testutil.MustClose(t, conn)
minVersion := version.Must(version.NewVersion("9.4"))
if serverVersion.LessThan(minVersion) {
t.Skipf("Skipping line test for server version %v", serverVersion)
if _, ok := conn.ConnInfo.DataTypeForName("line"); !ok {
t.Skip("Skipping due to no line type")
}
testutil.TestSuccessfulTranscode(t, "line", []interface{}{