| 23 | ) |
| 24 | |
| 25 | func TestCrateDBConnect(t *testing.T) { |
| 26 | t.Parallel() |
| 27 | |
| 28 | connString := os.Getenv("PGX_TEST_CRATEDB_CONN_STRING") |
| 29 | if connString == "" { |
| 30 | t.Skipf("Skipping due to missing environment variable %v", "PGX_TEST_CRATEDB_CONN_STRING") |
| 31 | } |
| 32 | |
| 33 | conn, err := pgx.Connect(context.Background(), connString) |
| 34 | require.Nil(t, err) |
| 35 | defer closeConn(t, conn) |
| 36 | |
| 37 | assert.Equal(t, connString, conn.Config().ConnString()) |
| 38 | |
| 39 | var result int |
| 40 | err = conn.QueryRow(context.Background(), "select 1 +1").Scan(&result) |
| 41 | if err != nil { |
| 42 | t.Fatalf("QueryRow Scan unexpectedly failed: %v", err) |
| 43 | } |
| 44 | if result != 2 { |
| 45 | t.Errorf("bad result: %d", result) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestConnect(t *testing.T) { |
| 50 | t.Parallel() |