Switch CI to CircleCI 2.0
This commit is contained in:
parent
6a86f8dd85
commit
47b0db257c
15
.travis.yml
15
.travis.yml
@ -1,15 +0,0 @@
|
||||
language: rust
|
||||
cache: cargo
|
||||
sudo: required
|
||||
rust:
|
||||
- nightly
|
||||
- 1.16.0
|
||||
addons:
|
||||
postgresql: 9.4
|
||||
before_script:
|
||||
- "./.travis/setup.sh"
|
||||
script:
|
||||
- cargo test --manifest-path=postgres/Cargo.toml
|
||||
- cargo test --manifest-path=postgres/Cargo.toml --features "$(cargo read-manifest --manifest-path=postgres/Cargo.toml | jq -r '.features|keys|map(select(. != "with-security-framework" and . != "with-schannel"))|join(" ")')"
|
||||
- cargo test --manifest-path=tokio-postgres/Cargo.toml
|
||||
- cargo test --manifest-path=postgres-protocol/Cargo.toml
|
@ -1,17 +0,0 @@
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
host all pass_user 127.0.0.1/32 password
|
||||
host all md5_user 127.0.0.1/32 md5
|
||||
host all pass_user ::1/128 password
|
||||
host all md5_user ::1/128 md5
|
||||
|
||||
hostssl all ssl_user 127.0.0.1/32 trust
|
||||
hostssl all ssl_user ::1/128 trust
|
||||
host all ssl_user 127.0.0.1/32 reject
|
||||
host all ssl_user ::1/128 reject
|
||||
|
||||
# IPv4 local connections:
|
||||
host all postgres 127.0.0.1/32 trust
|
||||
# IPv6 local connections:
|
||||
host all postgres ::1/128 trust
|
||||
# Unix socket connections:
|
||||
local all postgres trust
|
@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEAllItXwrj62MkxKVlz2FimJk42WWc3K82Rn2vAl6z38zQxSCj
|
||||
t9uWwXWTx5YOdGiUcA+JUAruZxqN7vdfphJoYtTrcrpT4rC/FsCMImBxkj1cxdYT
|
||||
q94SFn9bQBRZk7RUx4Kolt+/h0d3PpNIb4DbyQ8A0MVvNVxLpRRVwc6yQP+NkRMy
|
||||
gHR+m3P8fxHEtkHCVy7HORbASvN8fRlREMHDL2hkadX0BNM72DDo+DWhPA8GF6WX
|
||||
tIl1gU6GP6pSbEeMHD3f+uj7f9iSjvkrHrOt2nLUQ9Qnev2nhmU0/dOIweQ17/Fr
|
||||
lL9jYDUUFNORyjRnlXXUoP5BO/LdEAAqT2A0pwIDAQABAoIBAQCIXu74XUneHuiZ
|
||||
Wa+eTqwC4mZXmz6OWonzs0vU65NlgksXuv+r6ZO/2GoD1Bcy9jlL3Fxm+DPF56pB
|
||||
07u7TtHSb3VWdMFrU4tYGcBH45TE5dRHSmo4LlPcgxeGb6/ANwX+pYNKtJvuHyCH
|
||||
7Vf2iEFcCrdjrumv0BZ0IZmXJGxEV+7mK2Og0bZ/zbmJNaH25muuWj6BKlvLhL0N
|
||||
S2LlBjKx3HqtppUgUqNFqjLs6IA1u79S5dAomOsxZtnuByaX5WFzpktU2pveZmyF
|
||||
cl0dwHYZIaxR3ewYeQXGF8ANUmIx3nnxD2JOysPkitaGzeqt6dQZV14tPlDZDKat
|
||||
Vf0b6BHhAoGBAMWV7rG+7nVXoQ30CIcPGklkST3mVOlrzeBbKP1SeAwoGRbfsdhp
|
||||
rFMkh5UxTexnOzD4O8HPuJ6NGeWRQfqZT1nnjwHPeJWtiMHT6cnWxlzvxAZ61mio
|
||||
0jRfb8flhgFKk+G9+Xa6WaYAAwGWdF062EMe2Ym92oKM9ilTPGFVRk1XAoGBAMLD
|
||||
ETSQd2UqTF/y7wxMPqF3l6d1KBjwpuNuin2IjkXTOfGkDnAU3mSQlr7K1IPX8NPO
|
||||
gdyMfJoysfRaBuRcNA/o/0l0wyxW4HWtTtPYI0+pRCFtRLsI1MB997QKeaGKb+me
|
||||
3nBXkOksPSr9oa0Cs27z2cSoBOkpq2N/zzBseHExAoGAOyq3rKBZNehEwTHnb9I0
|
||||
8+9FA3U6zh9LKjkCIEGW00Uapj/cOMsEIG2a8DEwfW84SWS8OEBkr43fSGBkGo/Y
|
||||
NDrkFw2ytVee0TQNGTTod6IQ2EPmera7I5XEml5/71kOyZWi40vQVqZAQDR2qgha
|
||||
BFdzmwywJ1Hg0OUs+pSXlccCgYEAgyOVki80NYolovWQwFcWVOKR2s+oECL6PGlS
|
||||
FvS714hCm9I7ZnymwlAZMJ6iOaRNJFEIX9i4jZtU95Mm0NzEsXHRc0SLpm9Y8+Oe
|
||||
EEaYgCsZFOjePpHTr0kiYLgs7fipIkU2wa40hMyk4y2kjzoiV7MaDrCTnevQ205T
|
||||
0+c1sgECgYBAXKcwdkh9JVSrLXFamsxiOx3MZ0n6J1d28wpdA3y4Y4AAJm4TGgFt
|
||||
eG/6qHRy6CHdFtJ7a84EMe1jaVLQJYW/VrOC2bWLftkU7qaOnkXHvr4CAHsXQHcx
|
||||
JhLfvh4ab3KyoK/iimifvcoS5z9gp7IBFKMyh5IeJ9Y75TgcfJ5HMg==
|
||||
-----END RSA PRIVATE KEY-----
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
psql -U postgres < setup.sql
|
||||
|
||||
sudo cp pg_hba.conf $(psql -U postgres -c "SHOW hba_file" -At)
|
||||
|
||||
DATA_DIR=$(psql -U postgres -c "SHOW data_directory" -At)
|
||||
CONFIG_FILE=$(psql -U postgres -c "SHOW config_file" -At)
|
||||
sudo install -m 0600 -o postgres server.crt $DATA_DIR
|
||||
sudo install -m 0600 -o postgres server.key $DATA_DIR
|
||||
sudo bash -c "echo ssl_cert_file = \\'server.crt\\' >> $CONFIG_FILE"
|
||||
sudo bash -c "echo ssl_key_file = \\'server.key\\' >> $CONFIG_FILE"
|
||||
|
||||
sudo service postgresql stop
|
||||
sudo service postgresql start 9.4
|
@ -1,5 +0,0 @@
|
||||
CREATE ROLE pass_user PASSWORD 'password' LOGIN;
|
||||
CREATE ROLE md5_user PASSWORD 'password' LOGIN;
|
||||
CREATE ROLE ssl_user LOGIN;
|
||||
CREATE EXTENSION hstore;
|
||||
CREATE EXTENSION citext;
|
@ -25,7 +25,7 @@ struct Person {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.execute("CREATE TABLE person (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR NOT NULL,
|
||||
|
28
circle.yml
Normal file
28
circle.yml
Normal file
@ -0,0 +1,28 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/build
|
||||
docker:
|
||||
- image: jimmycuadra/rust:1.17.0
|
||||
- image: sfackler/rust-postgres-test:1
|
||||
steps:
|
||||
- checkout
|
||||
- run: apt-get update
|
||||
- run: DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends jq
|
||||
- restore_cache:
|
||||
key: registry
|
||||
- run: cargo generate-lockfile
|
||||
- save_cache:
|
||||
key: registry-{{ epoch }}
|
||||
paths:
|
||||
- ~/.cargo/registry/index
|
||||
- restore_cache:
|
||||
key: dependencies-{{ checksum "Cargo.lock" }}
|
||||
- run: cargo test --all
|
||||
- run: cargo test --manifest-path=postgres/Cargo.toml --features "$(cargo read-manifest --manifest-path=postgres/Cargo.toml | jq -r '.features|keys|map(select(. != "with-security-framework" and . != "with-schannel"))|join(" ")')"
|
||||
- run: cargo test --manifest-path=tokio-postgres/Cargo.toml --all-features
|
||||
- save_cache:
|
||||
key: dependencies-{{ checksum "Cargo.lock" }}
|
||||
paths:
|
||||
- target
|
||||
- ~/.cargo/registry/cache
|
6
docker-compose.yml
Normal file
6
docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
||||
version: '2'
|
||||
services:
|
||||
postgres:
|
||||
image: "sfackler/rust-postgres-test:1"
|
||||
ports:
|
||||
- 5433:5433
|
3
docker/Dockerfile
Normal file
3
docker/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM postgres:10-beta1
|
||||
|
||||
COPY sql_setup.sh /docker-entrypoint-initdb.d/
|
99
docker/sql_setup.sh
Executable file
99
docker/sql_setup.sh
Executable file
@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cat > "$PGDATA/server.key" <<-EOKEY
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEAllItXwrj62MkxKVlz2FimJk42WWc3K82Rn2vAl6z38zQxSCj
|
||||
t9uWwXWTx5YOdGiUcA+JUAruZxqN7vdfphJoYtTrcrpT4rC/FsCMImBxkj1cxdYT
|
||||
q94SFn9bQBRZk7RUx4Kolt+/h0d3PpNIb4DbyQ8A0MVvNVxLpRRVwc6yQP+NkRMy
|
||||
gHR+m3P8fxHEtkHCVy7HORbASvN8fRlREMHDL2hkadX0BNM72DDo+DWhPA8GF6WX
|
||||
tIl1gU6GP6pSbEeMHD3f+uj7f9iSjvkrHrOt2nLUQ9Qnev2nhmU0/dOIweQ17/Fr
|
||||
lL9jYDUUFNORyjRnlXXUoP5BO/LdEAAqT2A0pwIDAQABAoIBAQCIXu74XUneHuiZ
|
||||
Wa+eTqwC4mZXmz6OWonzs0vU65NlgksXuv+r6ZO/2GoD1Bcy9jlL3Fxm+DPF56pB
|
||||
07u7TtHSb3VWdMFrU4tYGcBH45TE5dRHSmo4LlPcgxeGb6/ANwX+pYNKtJvuHyCH
|
||||
7Vf2iEFcCrdjrumv0BZ0IZmXJGxEV+7mK2Og0bZ/zbmJNaH25muuWj6BKlvLhL0N
|
||||
S2LlBjKx3HqtppUgUqNFqjLs6IA1u79S5dAomOsxZtnuByaX5WFzpktU2pveZmyF
|
||||
cl0dwHYZIaxR3ewYeQXGF8ANUmIx3nnxD2JOysPkitaGzeqt6dQZV14tPlDZDKat
|
||||
Vf0b6BHhAoGBAMWV7rG+7nVXoQ30CIcPGklkST3mVOlrzeBbKP1SeAwoGRbfsdhp
|
||||
rFMkh5UxTexnOzD4O8HPuJ6NGeWRQfqZT1nnjwHPeJWtiMHT6cnWxlzvxAZ61mio
|
||||
0jRfb8flhgFKk+G9+Xa6WaYAAwGWdF062EMe2Ym92oKM9ilTPGFVRk1XAoGBAMLD
|
||||
ETSQd2UqTF/y7wxMPqF3l6d1KBjwpuNuin2IjkXTOfGkDnAU3mSQlr7K1IPX8NPO
|
||||
gdyMfJoysfRaBuRcNA/o/0l0wyxW4HWtTtPYI0+pRCFtRLsI1MB997QKeaGKb+me
|
||||
3nBXkOksPSr9oa0Cs27z2cSoBOkpq2N/zzBseHExAoGAOyq3rKBZNehEwTHnb9I0
|
||||
8+9FA3U6zh9LKjkCIEGW00Uapj/cOMsEIG2a8DEwfW84SWS8OEBkr43fSGBkGo/Y
|
||||
NDrkFw2ytVee0TQNGTTod6IQ2EPmera7I5XEml5/71kOyZWi40vQVqZAQDR2qgha
|
||||
BFdzmwywJ1Hg0OUs+pSXlccCgYEAgyOVki80NYolovWQwFcWVOKR2s+oECL6PGlS
|
||||
FvS714hCm9I7ZnymwlAZMJ6iOaRNJFEIX9i4jZtU95Mm0NzEsXHRc0SLpm9Y8+Oe
|
||||
EEaYgCsZFOjePpHTr0kiYLgs7fipIkU2wa40hMyk4y2kjzoiV7MaDrCTnevQ205T
|
||||
0+c1sgECgYBAXKcwdkh9JVSrLXFamsxiOx3MZ0n6J1d28wpdA3y4Y4AAJm4TGgFt
|
||||
eG/6qHRy6CHdFtJ7a84EMe1jaVLQJYW/VrOC2bWLftkU7qaOnkXHvr4CAHsXQHcx
|
||||
JhLfvh4ab3KyoK/iimifvcoS5z9gp7IBFKMyh5IeJ9Y75TgcfJ5HMg==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOKEY
|
||||
chmod 0600 "$PGDATA/server.key"
|
||||
|
||||
cat > "$PGDATA/server.crt" <<-EOCERT
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIID9DCCAtygAwIBAgIJAIYfg4EQ2pVAMA0GCSqGSIb3DQEBBQUAMFkxCzAJBgNV
|
||||
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
|
||||
aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0xNjA2MjgyMjQw
|
||||
NDFaFw0yNjA2MjYyMjQwNDFaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21l
|
||||
LVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNV
|
||||
BAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJZS
|
||||
LV8K4+tjJMSlZc9hYpiZONllnNyvNkZ9rwJes9/M0MUgo7fblsF1k8eWDnRolHAP
|
||||
iVAK7mcaje73X6YSaGLU63K6U+KwvxbAjCJgcZI9XMXWE6veEhZ/W0AUWZO0VMeC
|
||||
qJbfv4dHdz6TSG+A28kPANDFbzVcS6UUVcHOskD/jZETMoB0fptz/H8RxLZBwlcu
|
||||
xzkWwErzfH0ZURDBwy9oZGnV9ATTO9gw6Pg1oTwPBhell7SJdYFOhj+qUmxHjBw9
|
||||
3/ro+3/Yko75Kx6zrdpy1EPUJ3r9p4ZlNP3TiMHkNe/xa5S/Y2A1FBTTkco0Z5V1
|
||||
1KD+QTvy3RAAKk9gNKcCAwEAAaOBvjCBuzAdBgNVHQ4EFgQUEcuoFxzUZ4VV9VPv
|
||||
5frDyIuFA5cwgYsGA1UdIwSBgzCBgIAUEcuoFxzUZ4VV9VPv5frDyIuFA5ehXaRb
|
||||
MFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJ
|
||||
bnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdIIJAIYf
|
||||
g4EQ2pVAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHwMzmXdtz3R
|
||||
83HIdRQic40bJQf9ucSwY5ArkttPhC8ewQGyiGexm1Tvx9YA/qT2rscKPHXCPYcP
|
||||
IUE+nJTc8lQb8wPnFwGdHUsJfCvurxE4Yv4Oi74+q1enhHBGsvhFdFY5jTYD9unM
|
||||
zBEn+ZHX3PlKhe3wMub4khBTbPLK+n/laQWuZNsa+kj7BynkAg8W/6RK0Z0cJzzw
|
||||
aiVP0bSvatAAcSwkEfKEv5xExjWqoewjSlQLEZYIjJhXdtx/8AMnrcyxrFvKALUQ
|
||||
9M15FXvlPOB7ez14xIXQBKvvLwXvteHF6kYbzg/Bl1Q2GE9usclPa4UvTpnLv6gq
|
||||
NmFaAhoxnXA=
|
||||
-----END CERTIFICATE-----
|
||||
EOCERT
|
||||
|
||||
cat >> "$PGDATA/postgresql.conf" <<-EOCONF
|
||||
port = 5433
|
||||
ssl = on
|
||||
ssl_cert_file = 'server.crt'
|
||||
ssl_key_file = 'server.key'
|
||||
EOCONF
|
||||
|
||||
cat > "$PGDATA/pg_hba.conf" <<-EOCONF
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
host all pass_user 0.0.0.0/0 password
|
||||
host all md5_user 0.0.0.0/0 md5
|
||||
host all scram_user 0.0.0.0/0 scram-sha-256
|
||||
host all pass_user ::0/0 password
|
||||
host all md5_user ::0/0 md5
|
||||
host all scram_user ::0/0 scram-sha-256
|
||||
|
||||
hostssl all ssl_user 0.0.0.0/0 trust
|
||||
hostssl all ssl_user ::0/0 trust
|
||||
host all ssl_user 0.0.0.0/0 reject
|
||||
host all ssl_user ::0/0 reject
|
||||
|
||||
# IPv4 local connections:
|
||||
host all postgres 0.0.0.0/0 trust
|
||||
# IPv6 local connections:
|
||||
host all postgres ::0/0 trust
|
||||
# Unix socket connections:
|
||||
local all postgres trust
|
||||
EOCONF
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
||||
CREATE ROLE pass_user PASSWORD 'password' LOGIN;
|
||||
CREATE ROLE md5_user PASSWORD 'password' LOGIN;
|
||||
SET password_encryption TO 'scram-sha-256';
|
||||
CREATE ROLE scram_user PASSWORD 'password' LOGIN;
|
||||
CREATE ROLE ssl_user LOGIN;
|
||||
CREATE EXTENSION hstore;
|
||||
CREATE EXTENSION citext;
|
||||
EOSQL
|
@ -6,7 +6,7 @@ use postgres::{Connection, TlsMode};
|
||||
|
||||
#[bench]
|
||||
fn bench_naiive_execute(b: &mut test::Bencher) {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[])
|
||||
.unwrap();
|
||||
|
||||
@ -20,7 +20,7 @@ fn bench_naiive_execute(b: &mut test::Bencher) {
|
||||
|
||||
#[bench]
|
||||
fn bench_execute(b: &mut test::Bencher) {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[])
|
||||
.unwrap();
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
//! }
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let conn = Connection::connect("postgresql://postgres@localhost", TlsMode::None)
|
||||
//! let conn = Connection::connect("postgresql://postgres@localhost:5433", TlsMode::None)
|
||||
//! .unwrap();
|
||||
//!
|
||||
//! conn.execute("CREATE TABLE person (
|
||||
@ -62,7 +62,7 @@
|
||||
//! # #[cfg(feature = "with-native-tls")]
|
||||
//! fn main() {
|
||||
//! let negotiator = NativeTls::new().unwrap();
|
||||
//! let conn = Connection::connect("postgres://postgres@localhost", TlsMode::Require(&negotiator))
|
||||
//! let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::Require(&negotiator))
|
||||
//! .unwrap();
|
||||
//! }
|
||||
//! ```
|
||||
@ -1057,7 +1057,7 @@ impl Connection {
|
||||
/// ```rust,no_run
|
||||
/// use postgres::{Connection, TlsMode};
|
||||
///
|
||||
/// let url = "postgresql://postgres:hunter2@localhost:2994/foodb";
|
||||
/// let url = "postgresql://postgres:hunter2@localhost:5433:2994/foodb";
|
||||
/// let conn = Connection::connect(url, TlsMode::None).unwrap();
|
||||
/// ```
|
||||
///
|
||||
|
@ -38,7 +38,7 @@ mod types;
|
||||
#[test]
|
||||
fn test_non_default_database() {
|
||||
or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost/postgres",
|
||||
"postgres://postgres@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
));
|
||||
}
|
||||
@ -46,7 +46,7 @@ fn test_non_default_database() {
|
||||
#[test]
|
||||
fn test_url_terminating_slash() {
|
||||
or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost/",
|
||||
"postgres://postgres@localhost:5433/",
|
||||
TlsMode::None,
|
||||
));
|
||||
}
|
||||
@ -54,7 +54,7 @@ fn test_url_terminating_slash() {
|
||||
#[test]
|
||||
fn test_prepare_err() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = conn.prepare("invalid sql database");
|
||||
@ -67,7 +67,7 @@ fn test_prepare_err() {
|
||||
|
||||
#[test]
|
||||
fn test_unknown_database() {
|
||||
match Connection::connect("postgres://postgres@localhost/asdf", TlsMode::None) {
|
||||
match Connection::connect("postgres://postgres@localhost:5433/asdf", TlsMode::None) {
|
||||
Err(ConnectError::Db(ref e)) if e.code == InvalidCatalogName => {}
|
||||
Err(resp) => panic!("Unexpected result {:?}", resp),
|
||||
_ => panic!("Unexpected result"),
|
||||
@ -77,7 +77,7 @@ fn test_unknown_database() {
|
||||
#[test]
|
||||
fn test_connection_finish() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert!(conn.finish().is_ok());
|
||||
@ -87,7 +87,7 @@ fn test_connection_finish() {
|
||||
#[cfg_attr(not(unix), ignore)]
|
||||
fn test_unix_connection() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SHOW unix_socket_directories"));
|
||||
@ -112,7 +112,7 @@ fn test_unix_connection() {
|
||||
#[test]
|
||||
fn test_transaction_commit() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -137,7 +137,7 @@ fn test_transaction_commit() {
|
||||
#[test]
|
||||
fn test_transaction_commit_finish() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -162,7 +162,7 @@ fn test_transaction_commit_finish() {
|
||||
#[test]
|
||||
fn test_transaction_commit_method() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -186,7 +186,7 @@ fn test_transaction_commit_method() {
|
||||
#[test]
|
||||
fn test_transaction_rollback() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -212,7 +212,7 @@ fn test_transaction_rollback() {
|
||||
#[test]
|
||||
fn test_transaction_rollback_finish() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -238,7 +238,7 @@ fn test_transaction_rollback_finish() {
|
||||
#[test]
|
||||
fn test_nested_transactions() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -296,7 +296,7 @@ fn test_nested_transactions() {
|
||||
#[test]
|
||||
fn test_nested_transactions_finish() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -364,7 +364,7 @@ fn test_nested_transactions_finish() {
|
||||
#[should_panic(expected = "active transaction")]
|
||||
fn test_conn_trans_when_nested() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let _trans = or_panic!(conn.transaction());
|
||||
@ -375,7 +375,7 @@ fn test_conn_trans_when_nested() {
|
||||
#[should_panic(expected = "active transaction")]
|
||||
fn test_trans_with_nested_trans() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let trans = or_panic!(conn.transaction());
|
||||
@ -387,7 +387,7 @@ fn test_trans_with_nested_trans() {
|
||||
#[should_panic(expected = "active transaction")]
|
||||
fn test_trans_with_savepoints() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let trans = or_panic!(conn.transaction());
|
||||
@ -398,7 +398,7 @@ fn test_trans_with_savepoints() {
|
||||
#[test]
|
||||
fn test_stmt_execute_after_transaction() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let trans = or_panic!(conn.transaction());
|
||||
@ -411,7 +411,7 @@ fn test_stmt_execute_after_transaction() {
|
||||
#[test]
|
||||
fn test_stmt_finish() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -425,7 +425,7 @@ fn test_stmt_finish() {
|
||||
#[test]
|
||||
fn test_batch_execute() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let query = "CREATE TEMPORARY TABLE foo (id BIGINT PRIMARY KEY);
|
||||
@ -444,7 +444,7 @@ fn test_batch_execute() {
|
||||
#[test]
|
||||
fn test_batch_execute_error() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let query = "CREATE TEMPORARY TABLE foo (id BIGINT PRIMARY KEY);
|
||||
@ -464,7 +464,7 @@ fn test_batch_execute_error() {
|
||||
#[test]
|
||||
fn test_transaction_batch_execute() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let trans = or_panic!(conn.transaction());
|
||||
@ -484,7 +484,7 @@ fn test_transaction_batch_execute() {
|
||||
#[test]
|
||||
fn test_query() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -507,7 +507,7 @@ fn test_query() {
|
||||
#[test]
|
||||
fn test_error_after_datarow() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare(
|
||||
@ -529,7 +529,7 @@ FROM (SELECT gs.i
|
||||
#[test]
|
||||
fn test_lazy_query() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
|
||||
@ -555,11 +555,11 @@ fn test_lazy_query() {
|
||||
#[should_panic(expected = "same `Connection` as")]
|
||||
fn test_lazy_query_wrong_conn() {
|
||||
let conn1 = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let conn2 = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
|
||||
@ -571,7 +571,7 @@ fn test_lazy_query_wrong_conn() {
|
||||
#[test]
|
||||
fn test_param_types() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT $1::INT, $2::VARCHAR"));
|
||||
@ -581,7 +581,7 @@ fn test_param_types() {
|
||||
#[test]
|
||||
fn test_columns() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT 1::INT as a, 'hi'::VARCHAR as b"));
|
||||
@ -596,7 +596,7 @@ fn test_columns() {
|
||||
#[test]
|
||||
fn test_execute_counts() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert_eq!(
|
||||
@ -626,7 +626,7 @@ fn test_execute_counts() {
|
||||
#[test]
|
||||
fn test_wrong_param_type() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
match conn.execute("SELECT $1::VARCHAR", &[&1i32]) {
|
||||
@ -639,7 +639,7 @@ fn test_wrong_param_type() {
|
||||
#[should_panic(expected = "expected 2 parameters but got 1")]
|
||||
fn test_too_few_params() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let _ = conn.execute("SELECT $1::INT, $2::INT", &[&1i32]);
|
||||
@ -649,7 +649,7 @@ fn test_too_few_params() {
|
||||
#[should_panic(expected = "expected 2 parameters but got 3")]
|
||||
fn test_too_many_params() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let _ = conn.execute("SELECT $1::INT, $2::INT", &[&1i32, &2i32, &3i32]);
|
||||
@ -658,7 +658,7 @@ fn test_too_many_params() {
|
||||
#[test]
|
||||
fn test_index_named() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT 10::INT as val"));
|
||||
@ -677,7 +677,7 @@ fn test_index_named() {
|
||||
#[should_panic]
|
||||
fn test_index_named_fail() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT 10::INT as id"));
|
||||
@ -689,7 +689,7 @@ fn test_index_named_fail() {
|
||||
#[test]
|
||||
fn test_get_named_err() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT 10::INT as id"));
|
||||
@ -704,7 +704,7 @@ fn test_get_named_err() {
|
||||
#[test]
|
||||
fn test_get_was_null() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT NULL::INT as id"));
|
||||
@ -719,7 +719,7 @@ fn test_get_was_null() {
|
||||
#[test]
|
||||
fn test_get_off_by_one() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT 10::INT as id"));
|
||||
@ -746,7 +746,7 @@ fn test_custom_notice_handler() {
|
||||
}
|
||||
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost?client_min_messages=NOTICE",
|
||||
"postgres://postgres@localhost:5433?client_min_messages=NOTICE",
|
||||
TlsMode::None,
|
||||
));
|
||||
conn.set_notice_handler(Box::new(Handler));
|
||||
@ -766,7 +766,7 @@ fn test_custom_notice_handler() {
|
||||
#[test]
|
||||
fn test_notification_iterator_none() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert!(conn.notifications().iter().next().unwrap().is_none());
|
||||
@ -780,7 +780,7 @@ fn check_notification(expected: Notification, actual: Notification) {
|
||||
#[test]
|
||||
fn test_notification_iterator_some() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let notifications = conn.notifications();
|
||||
@ -838,14 +838,14 @@ fn test_notification_iterator_some() {
|
||||
#[test]
|
||||
fn test_notifications_next_block() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("LISTEN test_notifications_next_block", &[]));
|
||||
|
||||
let _t = thread::spawn(|| {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
@ -869,14 +869,14 @@ fn test_notifications_next_block() {
|
||||
#[test]
|
||||
fn test_notification_next_timeout() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("LISTEN test_notifications_next_timeout", &[]));
|
||||
|
||||
let _t = thread::spawn(|| {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
@ -909,7 +909,7 @@ fn test_notification_next_timeout() {
|
||||
// This test is pretty sad, but I don't think there's a better way :(
|
||||
fn test_cancel_query() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let cancel_data = conn.cancel_data();
|
||||
@ -917,7 +917,7 @@ fn test_cancel_query() {
|
||||
let t = thread::spawn(move || {
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
assert!(
|
||||
postgres::cancel_query("postgres://postgres@localhost", TlsMode::None, &cancel_data)
|
||||
postgres::cancel_query("postgres://postgres@localhost:5433", TlsMode::None, &cancel_data)
|
||||
.is_ok()
|
||||
);
|
||||
});
|
||||
@ -940,11 +940,11 @@ fn test_require_ssl_conn() {
|
||||
let mut builder = SslConnectorBuilder::new(SslMethod::tls()).unwrap();
|
||||
builder
|
||||
.builder_mut()
|
||||
.set_ca_file("../.travis/server.crt")
|
||||
.set_ca_file("../test/server.crt")
|
||||
.unwrap();
|
||||
let negotiator = OpenSsl::from(builder.build());
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::Require(&negotiator),
|
||||
));
|
||||
or_panic!(conn.execute("SELECT 1::VARCHAR", &[]));
|
||||
@ -959,11 +959,11 @@ fn test_prefer_ssl_conn() {
|
||||
let mut builder = SslConnectorBuilder::new(SslMethod::tls()).unwrap();
|
||||
builder
|
||||
.builder_mut()
|
||||
.set_ca_file("../.travis/server.crt")
|
||||
.set_ca_file("../test/server.crt")
|
||||
.unwrap();
|
||||
let negotiator = OpenSsl::from(builder.build());
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::Require(&negotiator),
|
||||
));
|
||||
or_panic!(conn.execute("SELECT 1::VARCHAR", &[]));
|
||||
@ -975,12 +975,12 @@ fn security_framework_ssl() {
|
||||
use postgres::tls::security_framework::SecurityFramework;
|
||||
use security_framework::certificate::SecCertificate;
|
||||
|
||||
let certificate = include_bytes!("../../.travis/server.der");
|
||||
let certificate = include_bytes!("../../test/server.der");
|
||||
let certificate = or_panic!(SecCertificate::from_der(certificate));
|
||||
let mut negotiator = SecurityFramework::new();
|
||||
negotiator.builder_mut().anchor_certificates(&[certificate]);
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::Require(&negotiator),
|
||||
));
|
||||
or_panic!(conn.execute("SELECT 1::VARCHAR", &[]));
|
||||
@ -995,7 +995,7 @@ fn native_tls_ssl() {
|
||||
|
||||
let negotiator = NativeTls::new().unwrap();
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::Require(&negotiator),
|
||||
));
|
||||
or_panic!(conn.execute("SELECT 1::VARCHAR", &[]));
|
||||
@ -1004,14 +1004,14 @@ fn native_tls_ssl() {
|
||||
#[test]
|
||||
fn test_plaintext_pass() {
|
||||
or_panic!(Connection::connect(
|
||||
"postgres://pass_user:password@localhost/postgres",
|
||||
"postgres://pass_user:password@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_plaintext_pass_no_pass() {
|
||||
let ret = Connection::connect("postgres://pass_user@localhost/postgres", TlsMode::None);
|
||||
let ret = Connection::connect("postgres://pass_user@localhost:5433/postgres", TlsMode::None);
|
||||
match ret {
|
||||
Err(ConnectError::ConnectParams(..)) => (),
|
||||
Err(err) => panic!("Unexpected error {:?}", err),
|
||||
@ -1022,7 +1022,7 @@ fn test_plaintext_pass_no_pass() {
|
||||
#[test]
|
||||
fn test_plaintext_pass_wrong_pass() {
|
||||
let ret = Connection::connect(
|
||||
"postgres://pass_user:asdf@localhost/postgres",
|
||||
"postgres://pass_user:asdf@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
);
|
||||
match ret {
|
||||
@ -1035,14 +1035,14 @@ fn test_plaintext_pass_wrong_pass() {
|
||||
#[test]
|
||||
fn test_md5_pass() {
|
||||
or_panic!(Connection::connect(
|
||||
"postgres://md5_user:password@localhost/postgres",
|
||||
"postgres://md5_user:password@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_md5_pass_no_pass() {
|
||||
let ret = Connection::connect("postgres://md5_user@localhost/postgres", TlsMode::None);
|
||||
let ret = Connection::connect("postgres://md5_user@localhost:5433/postgres", TlsMode::None);
|
||||
match ret {
|
||||
Err(ConnectError::ConnectParams(..)) => (),
|
||||
Err(err) => panic!("Unexpected error {:?}", err),
|
||||
@ -1052,7 +1052,35 @@ fn test_md5_pass_no_pass() {
|
||||
|
||||
#[test]
|
||||
fn test_md5_pass_wrong_pass() {
|
||||
let ret = Connection::connect("postgres://md5_user:asdf@localhost/postgres", TlsMode::None);
|
||||
let ret = Connection::connect("postgres://md5_user:asdf@localhost:5433/postgres", TlsMode::None);
|
||||
match ret {
|
||||
Err(ConnectError::Db(ref e)) if e.code == InvalidPassword => {}
|
||||
Err(err) => panic!("Unexpected error {:?}", err),
|
||||
_ => panic!("Expected error"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scram_pass() {
|
||||
or_panic!(Connection::connect(
|
||||
"postgres://scram_user:password@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scram_pass_no_pass() {
|
||||
let ret = Connection::connect("postgres://scram_user@localhost:5433/postgres", TlsMode::None);
|
||||
match ret {
|
||||
Err(ConnectError::ConnectParams(..)) => (),
|
||||
Err(err) => panic!("Unexpected error {:?}", err),
|
||||
_ => panic!("Expected error"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scram_pass_wrong_pass() {
|
||||
let ret = Connection::connect("postgres://scram_user:asdf@localhost:5433/postgres", TlsMode::None);
|
||||
match ret {
|
||||
Err(ConnectError::Db(ref e)) if e.code == InvalidPassword => {}
|
||||
Err(err) => panic!("Unexpected error {:?}", err),
|
||||
@ -1063,7 +1091,7 @@ fn test_md5_pass_wrong_pass() {
|
||||
#[test]
|
||||
fn test_execute_copy_from_err() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[]));
|
||||
@ -1083,7 +1111,7 @@ fn test_execute_copy_from_err() {
|
||||
#[test]
|
||||
fn test_batch_execute_copy_from_err() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[]));
|
||||
@ -1105,7 +1133,7 @@ fn test_copy_io_error() {
|
||||
}
|
||||
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[]));
|
||||
@ -1122,7 +1150,7 @@ fn test_copy_io_error() {
|
||||
#[test]
|
||||
fn test_copy() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[]));
|
||||
@ -1143,7 +1171,7 @@ fn test_copy() {
|
||||
#[test]
|
||||
fn test_query_copy_out_err() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.batch_execute(
|
||||
@ -1162,7 +1190,7 @@ fn test_query_copy_out_err() {
|
||||
#[test]
|
||||
fn test_copy_out() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.batch_execute(
|
||||
@ -1183,7 +1211,7 @@ fn test_copy_out() {
|
||||
#[test]
|
||||
fn test_copy_out_error() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.batch_execute(
|
||||
@ -1213,7 +1241,7 @@ fn test_generic_connection() {
|
||||
}
|
||||
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
f(&conn);
|
||||
@ -1224,7 +1252,7 @@ fn test_generic_connection() {
|
||||
#[test]
|
||||
fn test_custom_range_element_type() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -1247,7 +1275,7 @@ fn test_custom_range_element_type() {
|
||||
#[test]
|
||||
fn test_prepare_cached() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute("CREATE TEMPORARY TABLE foo (id INT)", &[]));
|
||||
@ -1287,7 +1315,7 @@ fn test_prepare_cached() {
|
||||
#[test]
|
||||
fn test_is_active() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert!(conn.is_active());
|
||||
@ -1310,7 +1338,7 @@ fn test_is_active() {
|
||||
#[test]
|
||||
fn test_parameter() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert_eq!(Some("UTF8".to_string()), conn.parameter("client_encoding"));
|
||||
@ -1320,7 +1348,7 @@ fn test_parameter() {
|
||||
#[test]
|
||||
fn test_get_bytes() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT '\\x00010203'::BYTEA"));
|
||||
@ -1333,7 +1361,7 @@ fn test_get_bytes() {
|
||||
|
||||
#[test]
|
||||
fn test_get_opt_wrong_type() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
let stmt = conn.prepare("SELECT 1::INT").unwrap();
|
||||
let res = stmt.query(&[]).unwrap();
|
||||
match res.iter().next().unwrap().get_opt::<_, String>(0) {
|
||||
@ -1347,7 +1375,7 @@ fn test_get_opt_wrong_type() {
|
||||
#[test]
|
||||
fn url_unencoded_password() {
|
||||
assert!(
|
||||
"postgresql://username:password%1*@localhost"
|
||||
"postgresql://username:password%1*@localhost:5433"
|
||||
.into_connect_params()
|
||||
.is_err()
|
||||
)
|
||||
@ -1355,7 +1383,7 @@ fn url_unencoded_password() {
|
||||
|
||||
#[test]
|
||||
fn url_encoded_password() {
|
||||
let params = "postgresql://username%7b%7c:password%7b%7c@localhost"
|
||||
let params = "postgresql://username%7b%7c:password%7b%7c@localhost:5433"
|
||||
.into_connect_params()
|
||||
.unwrap();
|
||||
assert_eq!("username{|", params.user().unwrap().name());
|
||||
@ -1365,7 +1393,7 @@ fn url_encoded_password() {
|
||||
#[test]
|
||||
fn test_transaction_isolation_level() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
assert_eq!(
|
||||
@ -1412,7 +1440,7 @@ fn test_transaction_isolation_level() {
|
||||
|
||||
#[test]
|
||||
fn test_rows_index() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"
|
||||
CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY);
|
||||
@ -1427,7 +1455,7 @@ fn test_rows_index() {
|
||||
|
||||
#[test]
|
||||
fn test_row_case_insensitive() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (foo INT, \"bAr\" INT, \"Bar\" INT);",
|
||||
).unwrap();
|
||||
@ -1441,7 +1469,7 @@ fn test_row_case_insensitive() {
|
||||
|
||||
#[test]
|
||||
fn test_type_names() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
let stmt = conn.prepare(
|
||||
"SELECT t.oid, t.typname
|
||||
FROM pg_catalog.pg_type t, pg_namespace n
|
||||
@ -1459,7 +1487,7 @@ fn test_type_names() {
|
||||
|
||||
#[test]
|
||||
fn test_conn_query() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"
|
||||
CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY);
|
||||
@ -1476,7 +1504,7 @@ fn test_conn_query() {
|
||||
|
||||
#[test]
|
||||
fn transaction_config() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
let mut config = transaction::Config::new();
|
||||
config
|
||||
.isolation_level(IsolationLevel::Serializable)
|
||||
@ -1487,7 +1515,7 @@ fn transaction_config() {
|
||||
|
||||
#[test]
|
||||
fn transaction_config_one_setting() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.set_transaction_config(transaction::Config::new().read_only(true))
|
||||
.unwrap();
|
||||
conn.set_transaction_config(transaction::Config::new().deferrable(true))
|
||||
@ -1496,7 +1524,7 @@ fn transaction_config_one_setting() {
|
||||
|
||||
#[test]
|
||||
fn transaction_with() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
let mut config = transaction::Config::new();
|
||||
config
|
||||
.isolation_level(IsolationLevel::Serializable)
|
||||
@ -1507,7 +1535,7 @@ fn transaction_with() {
|
||||
|
||||
#[test]
|
||||
fn transaction_set_config() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
let trans = conn.transaction().unwrap();
|
||||
let mut config = transaction::Config::new();
|
||||
config
|
||||
|
@ -28,7 +28,7 @@ mod geo;
|
||||
|
||||
fn test_type<T: PartialEq + FromSql + ToSql, S: fmt::Display>(sql_type: &str, checks: &[(T, S)]) {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
for &(ref val, ref repr) in checks.iter() {
|
||||
@ -45,7 +45,7 @@ fn test_type<T: PartialEq + FromSql + ToSql, S: fmt::Display>(sql_type: &str, ch
|
||||
#[test]
|
||||
fn test_ref_tosql() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = conn.prepare("SELECT $1::Int").unwrap();
|
||||
@ -188,7 +188,7 @@ fn test_text_params() {
|
||||
#[test]
|
||||
fn test_bpchar_params() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -214,7 +214,7 @@ fn test_bpchar_params() {
|
||||
#[test]
|
||||
fn test_citext_params() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
or_panic!(conn.execute(
|
||||
@ -296,7 +296,7 @@ fn test_array_params() {
|
||||
|
||||
fn test_nan_param<T: PartialEq + ToSql + FromSql>(sql_type: &str) {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare(&*format!("SELECT 'NaN'::{}", sql_type)));
|
||||
@ -318,7 +318,7 @@ fn test_f64_nan_param() {
|
||||
#[test]
|
||||
fn test_pg_database_datname() {
|
||||
let conn = or_panic!(Connection::connect(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
));
|
||||
let stmt = or_panic!(conn.prepare("SELECT datname FROM pg_database"));
|
||||
@ -331,7 +331,7 @@ fn test_pg_database_datname() {
|
||||
|
||||
#[test]
|
||||
fn test_slice() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL PRIMARY KEY, f VARCHAR);
|
||||
INSERT INTO foo (f) VALUES ('a'), ('b'), ('c'), ('d');",
|
||||
@ -351,7 +351,7 @@ fn test_slice() {
|
||||
|
||||
#[test]
|
||||
fn test_slice_wrong_type() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute("CREATE TEMPORARY TABLE foo (id SERIAL PRIMARY KEY)")
|
||||
.unwrap();
|
||||
|
||||
@ -366,7 +366,7 @@ fn test_slice_wrong_type() {
|
||||
|
||||
#[test]
|
||||
fn test_slice_range() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
|
||||
let stmt = conn.prepare("SELECT $1::INT8RANGE").unwrap();
|
||||
match stmt.query(&[&&[1i64][..]]) {
|
||||
@ -419,7 +419,7 @@ fn domain() {
|
||||
}
|
||||
}
|
||||
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"CREATE DOMAIN pg_temp.session_id AS bytea CHECK(octet_length(VALUE) = 16);
|
||||
CREATE TABLE pg_temp.foo (id pg_temp.session_id);",
|
||||
@ -434,7 +434,7 @@ fn domain() {
|
||||
|
||||
#[test]
|
||||
fn composite() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute(
|
||||
"CREATE TYPE pg_temp.inventory_item AS (
|
||||
name TEXT,
|
||||
@ -461,7 +461,7 @@ fn composite() {
|
||||
|
||||
#[test]
|
||||
fn enum_() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
|
||||
conn.batch_execute("CREATE TYPE pg_temp.mood AS ENUM ('sad', 'ok', 'happy');")
|
||||
.unwrap();
|
||||
|
||||
@ -478,14 +478,3 @@ fn enum_() {
|
||||
_ => panic!("bad type"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown() {
|
||||
let conn = Connection::connect("postgres://postgres@localhost", TlsMode::None).unwrap();
|
||||
let rows = conn.query("SELECT 'hello world'", &[]).unwrap();
|
||||
match *rows.columns()[0].type_() {
|
||||
Type::Unknown => {}
|
||||
_ => panic!("bad type"),
|
||||
}
|
||||
assert_eq!("hello world", rows.get(0).get::<_, String>(0));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let mut l = Core::new().unwrap();
|
||||
//! let done = Connection::connect("postgresql://postgres@localhost",
|
||||
//! let done = Connection::connect("postgresql://postgres@localhost:5433",
|
||||
//! TlsMode::None,
|
||||
//! &l.handle())
|
||||
//! .then(|c| {
|
||||
|
@ -15,7 +15,7 @@ fn md5_user() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://md5_user:password@localhost/postgres",
|
||||
"postgres://md5_user:password@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -27,7 +27,7 @@ fn md5_user_no_pass() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://md5_user@localhost/postgres",
|
||||
"postgres://md5_user@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -43,7 +43,7 @@ fn md5_user_wrong_pass() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://md5_user:foobar@localhost/postgres",
|
||||
"postgres://md5_user:foobar@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -59,7 +59,7 @@ fn pass_user() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://pass_user:password@localhost/postgres",
|
||||
"postgres://pass_user:password@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -71,7 +71,7 @@ fn pass_user_no_pass() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://pass_user@localhost/postgres",
|
||||
"postgres://pass_user@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -87,7 +87,7 @@ fn pass_user_wrong_pass() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect(
|
||||
"postgres://pass_user:foobar@localhost/postgres",
|
||||
"postgres://pass_user:foobar@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -101,7 +101,7 @@ fn pass_user_wrong_pass() {
|
||||
#[test]
|
||||
fn batch_execute_ok() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL);",
|
||||
@ -113,7 +113,7 @@ fn batch_execute_ok() {
|
||||
#[test]
|
||||
fn batch_execute_err() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|r| {
|
||||
r.unwrap().batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL); INSERT INTO foo DEFAULT \
|
||||
@ -135,7 +135,7 @@ fn batch_execute_err() {
|
||||
#[test]
|
||||
fn prepare_execute() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|c| {
|
||||
c.unwrap().prepare(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL PRIMARY KEY, name VARCHAR)",
|
||||
@ -154,7 +154,7 @@ fn prepare_execute() {
|
||||
#[test]
|
||||
fn prepare_execute_rows() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|c| c.unwrap().prepare("SELECT 1"))
|
||||
.and_then(|(s, c)| c.execute(&s, &[]));
|
||||
l.run(done).unwrap();
|
||||
@ -163,7 +163,7 @@ fn prepare_execute_rows() {
|
||||
#[test]
|
||||
fn query() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL, name VARCHAR);
|
||||
@ -187,7 +187,7 @@ fn query() {
|
||||
#[test]
|
||||
fn transaction() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &l.handle())
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &l.handle())
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE TEMPORARY TABLE foo (id SERIAL, name VARCHAR);",
|
||||
@ -220,7 +220,7 @@ fn transaction() {
|
||||
fn unix_socket() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(|c| c.unwrap().prepare("SHOW unix_socket_directories"))
|
||||
.and_then(|(s, c)| c.query(&s, &[]).collect())
|
||||
.then(|r| {
|
||||
@ -242,7 +242,7 @@ fn ssl_user_ssl_required() {
|
||||
let handle = l.handle();
|
||||
|
||||
let done = Connection::connect(
|
||||
"postgres://ssl_user@localhost/postgres",
|
||||
"postgres://ssl_user@localhost:5433/postgres",
|
||||
TlsMode::None,
|
||||
&handle,
|
||||
);
|
||||
@ -263,13 +263,13 @@ fn openssl_required() {
|
||||
let mut builder = SslConnectorBuilder::new(SslMethod::tls()).unwrap();
|
||||
builder
|
||||
.builder_mut()
|
||||
.set_ca_file("../.travis/server.crt")
|
||||
.set_ca_file("../test/server.crt")
|
||||
.unwrap();
|
||||
let negotiator = OpenSsl::from(builder.build());
|
||||
|
||||
let mut l = Core::new().unwrap();
|
||||
let done = Connection::connect(
|
||||
"postgres://ssl_user@localhost/postgres",
|
||||
"postgres://ssl_user@localhost:5433/postgres",
|
||||
TlsMode::Require(Box::new(negotiator)),
|
||||
&l.handle(),
|
||||
).then(|c| c.unwrap().prepare("SELECT 1"))
|
||||
@ -319,7 +319,7 @@ fn domain() {
|
||||
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE DOMAIN pg_temp.session_id AS bytea \
|
||||
@ -348,7 +348,7 @@ fn composite() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE TYPE pg_temp.inventory_item AS (
|
||||
@ -382,7 +382,7 @@ fn enum_() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(|c| {
|
||||
c.unwrap().batch_execute(
|
||||
"CREATE TYPE pg_temp.mood AS ENUM ('sad', 'ok', 'happy');",
|
||||
@ -411,7 +411,7 @@ fn cancel() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(move |c| {
|
||||
let c = c.unwrap();
|
||||
let cancel_data = c.cancel_data();
|
||||
@ -421,7 +421,7 @@ fn cancel() {
|
||||
.then(move |r| {
|
||||
assert!(r.is_ok());
|
||||
cancel_query(
|
||||
"postgres://postgres@localhost",
|
||||
"postgres://postgres@localhost:5433",
|
||||
TlsMode::None,
|
||||
cancel_data,
|
||||
&handle,
|
||||
@ -447,10 +447,10 @@ fn notifications() {
|
||||
let mut l = Core::new().unwrap();
|
||||
let handle = l.handle();
|
||||
|
||||
let done = Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle)
|
||||
let done = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle)
|
||||
.then(|c| c.unwrap().batch_execute("LISTEN test_notifications"))
|
||||
.and_then(|c1| {
|
||||
Connection::connect("postgres://postgres@localhost", TlsMode::None, &handle).then(
|
||||
Connection::connect("postgres://postgres@localhost:5433", TlsMode::None, &handle).then(
|
||||
|c2| {
|
||||
c2.unwrap()
|
||||
.batch_execute("NOTIFY test_notifications, 'foo'")
|
||||
|
Loading…
Reference in New Issue
Block a user