mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
A couple of test cases had connect_timeout=14, a value that seems to have been plucked from a hat. While it's more than sufficient for normal cases, slow/overloaded buildfarm machines can get a timeout failure here, as per recent report from "sungazer". Increase to 180 seconds, which is in line with our typical timeouts elsewhere in the regression tests. Back-patch to 9.6; the code looks different in 9.5, and this doesn't seem to be quite worth the effort to adapt to that. Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sungazer&dt=2020-08-04%2007%3A12%3A22
65 lines
1.9 KiB
Text
65 lines
1.9 KiB
Text
/*
|
|
* this file tests all sorts of connecting to one single database.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
/* do not include regression.h */
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
exec sql begin declare section;
|
|
char db[200];
|
|
char pw[200];
|
|
exec sql end declare section;
|
|
|
|
ECPGdebug(1, stderr);
|
|
|
|
exec sql connect to ecpg2_regression as main;
|
|
exec sql alter user regress_ecpg_user1 ENCRYPTED PASSWORD 'connectpw';
|
|
exec sql disconnect; /* <-- "main" not specified */
|
|
|
|
exec sql connect to ecpg2_regression@localhost as main;
|
|
exec sql disconnect main;
|
|
|
|
exec sql connect to @localhost as main user regress_ecpg_user2;
|
|
exec sql disconnect main;
|
|
|
|
/* exec sql connect to :@TEMP_PORT@ as main user regress_ecpg_user2;
|
|
exec sql disconnect main; */
|
|
|
|
exec sql connect to tcp:postgresql://localhost/ecpg2_regression user regress_ecpg_user1 identified by connectpw;
|
|
exec sql disconnect;
|
|
|
|
exec sql connect to tcp:postgresql://localhost/ user regress_ecpg_user2;
|
|
exec sql disconnect;
|
|
|
|
strcpy(pw, "connectpw");
|
|
strcpy(db, "tcp:postgresql://localhost/ecpg2_regression");
|
|
exec sql connect to :db user regress_ecpg_user1 using :pw;
|
|
exec sql disconnect;
|
|
|
|
exec sql connect to unix:postgresql://localhost/ecpg2_regression user regress_ecpg_user1 using "connectpw";
|
|
exec sql disconnect;
|
|
|
|
exec sql connect to unix:postgresql://localhost/ecpg2_regression?connect_timeout=180 user regress_ecpg_user1;
|
|
exec sql disconnect;
|
|
|
|
/* wrong db */
|
|
exec sql connect to tcp:postgresql://localhost/nonexistent user regress_ecpg_user1 identified by connectpw;
|
|
exec sql disconnect;
|
|
|
|
/* wrong port */
|
|
exec sql connect to tcp:postgresql://127.0.0.1:20/ecpg2_regression user regress_ecpg_user1 identified by connectpw;
|
|
/* no disconnect necessary */
|
|
|
|
/* wrong password */
|
|
exec sql connect to unix:postgresql://localhost/ecpg2_regression user regress_ecpg_user1 identified by "wrongpw";
|
|
/* no disconnect necessary */
|
|
|
|
return 0;
|
|
}
|