Skip to content

Commit 9bb5eec

Browse files
committed
Avoid ECPG test failures in some GSS-capable environments.
Buildfarm member hamerkop has been reporting that two cases in connect/test5.pgc show different error messages than the test expects, because since commit ffa2e46 libpq's connection failure messages are exposing the fact that a GSS-encrypted connection was attempted and failed. That's pretty interesting information in itself, and I certainly don't wish to shoot the messenger, but we need to do something to stabilize the ECPG results. For the second of these two failure cases, we can add the gssencmode=disable option to prevent the discrepancy. However, that solution is problematic for the first failure, because the only unique thing about that case is that it's testing a completely-omitted connection target; there's noplace to add the option without defeating the point of the test case. After some thrashing around with alternative fixes that turned out to have undesirable side-effects, the most workable answer is just to give up and remove that test case. Perhaps we can revert this later, if we figure out why the GSS code is misbehaving in hamerkop's environment. Thanks to Michael Paquier for exploration of alternatives. Discussion: https://postgr.es/m/YLRZH6CWs9N6Pusy@paquier.xyz
1 parent b29fa95 commit 9bb5eec

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

src/interfaces/ecpg/test/connect/test5.pgc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ exec sql end declare section;
4040
exec sql connect to 'ecpg2_regression' as main;
4141
exec sql disconnect main;
4242

43-
exec sql connect to as main user regress_ecpg_user2/insecure;
44-
exec sql disconnect main;
43+
/* exec sql connect to as main user regress_ecpg_user2/insecure;
44+
exec sql disconnect main; */
4545

4646
exec sql connect to ecpg2_regression as main user regress_ecpg_user1/connectpw;
4747
exec sql disconnect main;
@@ -61,7 +61,7 @@ exec sql end declare section;
6161
exec sql connect to "unix:postgresql://200.46.204.71/ecpg2_regression" as main user regress_ecpg_user1/connectpw;
6262
exec sql disconnect main;
6363

64-
exec sql connect to unix:postgresql://localhost/ as main user regress_ecpg_user2 IDENTIFIED BY insecure;
64+
exec sql connect to "unix:postgresql://localhost/?gssencmode=disable" as main user regress_ecpg_user2 IDENTIFIED BY insecure;
6565
exec sql disconnect main;
6666

6767
/* connect twice */

src/interfaces/ecpg/test/expected/connect-test5.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ main(void)
8686
#line 41 "test5.pgc"
8787

8888

89-
{ ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); }
90-
#line 43 "test5.pgc"
91-
92-
{ ECPGdisconnect(__LINE__, "main");}
93-
#line 44 "test5.pgc"
94-
89+
/* exec sql connect to as main user regress_ecpg_user2/insecure;
90+
exec sql disconnect main; */
9591

9692
{ ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
9793
#line 46 "test5.pgc"
@@ -135,7 +131,7 @@ main(void)
135131
#line 62 "test5.pgc"
136132

137133

138-
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "regress_ecpg_user2" , "insecure" , "main", 0); }
134+
{ ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/?gssencmode=disable" , "regress_ecpg_user2" , "insecure" , "main", 0); }
139135
#line 64 "test5.pgc"
140136

141137
{ ECPGdisconnect(__LINE__, "main");}

src/interfaces/ecpg/test/expected/connect-test5.stderr

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@
3434
[NO_PID]: sqlca: code: 0, state: 00000
3535
[NO_PID]: ecpg_finish: connection main closed
3636
[NO_PID]: sqlca: code: 0, state: 00000
37-
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user regress_ecpg_user2
38-
[NO_PID]: sqlca: code: 0, state: 00000
39-
[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
40-
[NO_PID]: sqlca: code: 0, state: 00000
41-
[NO_PID]: ecpg_finish: connection main closed
42-
[NO_PID]: sqlca: code: 0, state: 00000
43-
[NO_PID]: raising sqlcode -402 on line 43: could not connect to database "<DEFAULT>" on line 43
44-
[NO_PID]: sqlca: code: -402, state: 08001
45-
[NO_PID]: raising sqlcode -220 on line 44: connection "main" does not exist on line 44
46-
[NO_PID]: sqlca: code: -220, state: 08003
4737
[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
4838
[NO_PID]: sqlca: code: 0, state: 00000
4939
[NO_PID]: ecpg_finish: connection main closed
@@ -70,7 +60,7 @@
7060
[NO_PID]: sqlca: code: -402, state: 08001
7161
[NO_PID]: raising sqlcode -220 on line 62: connection "main" does not exist on line 62
7262
[NO_PID]: sqlca: code: -220, state: 08003
73-
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user regress_ecpg_user2
63+
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> with options gssencmode=disable for user regress_ecpg_user2
7464
[NO_PID]: sqlca: code: 0, state: 00000
7565
[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist
7666
[NO_PID]: sqlca: code: 0, state: 00000

0 commit comments

Comments
 (0)