Skip to content

Commit 18a549e

Browse files
committed
Reset postgres port and use a wrong server instead
1 parent 84b3fbb commit 18a549e

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ addons:
1717
postgresql: 10
1818

1919
before_script:
20-
- sudo -u postgres psql -c "CREATE USER foo WITH PASSWORD 'bar';" -h localhost -p $PGPORT -U postgres
21-
- sudo -u postgres createdb -O foo -h localhost -p $PGPORT foo
20+
- sudo -u postgres psql -c "CREATE USER foo WITH PASSWORD 'bar';" -U postgres
21+
- sudo -u postgres createdb -O foo foo
2222

2323
script:
2424
- cargo test -- --nocapture || travis_terminate 1
@@ -30,10 +30,9 @@ env:
3030
global:
3131
- ODBC_SYS_STATIC_PATH=/usr/lib/x86_64-linux-gnu/
3232
- POSTGRES_SERVER=localhost
33-
- POSTGRES_PORT=5433
33+
- POSTGRES_PORT=5432
3434
- POSTGRES_USERNAME=foo
3535
- POSTGRES_PASSWORD=bar
36-
- PGPORT=5433
3736
- RUST_BACKTRACE=1
3837
- POSTGRES_DRIVER=/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
3938
- SQLITE_DRIVER=/usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so

src/odbc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ mod test {
137137

138138
#[test]
139139
#[cfg_attr(postgres_driver = "", ignore)]
140-
fn test_postgres_with_no_server() {
140+
fn test_postgres_with_wrong_server() {
141141
let err = connect(&Opts::new().connection_string(format!(
142-
"Driver={};",
142+
"Driver={};Server=tevp.net",
143143
std::env::var("POSTGRES_DRIVER").unwrap()
144144
)))
145145
.unwrap_err();
146146
assert_eq!(err.kind, DbErrorLifetime::Temporary, "{:?}", err);
147147
if let DbErrorType::OdbcError { error } = err.error {
148148
let desc = format!("{}", error);
149149
assert!(
150-
desc.contains("could not connect to server: No such file or directory"),
150+
desc.contains("could not connect to server: Connection refused"),
151151
desc
152152
);
153153
}

0 commit comments

Comments
 (0)