@@ -762,7 +762,6 @@ public void various() throws SQLException {
762762 assertEquals (ResultSet .HOLD_CURSORS_OVER_COMMIT , sharedConn .getHoldability ());
763763 sharedConn .setHoldability (ResultSet .CLOSE_CURSORS_AT_COMMIT );
764764 assertEquals (ResultSet .HOLD_CURSORS_OVER_COMMIT , sharedConn .getHoldability ());
765-  assertNotEquals (0 , sharedConn .getWaitTimeout ());
766765 }
767766
768767 @ Test 
@@ -814,7 +813,6 @@ public void pamAuthPlugin() throws Throwable {
814813 Assumptions .assumeTrue (
815814 isMariaDBServer ()
816815 && System .getenv ("TEST_PAM_USER" ) != null 
817-  && !"maxscale" .equals (System .getenv ("srv" ))
818816 && !"skysql" .equals (System .getenv ("srv" ))
819817 && !"skysql-ha" .equals (System .getenv ("srv" )));
820818
@@ -824,21 +822,40 @@ public void pamAuthPlugin() throws Throwable {
824822 } catch  (SQLException  sqle ) {
825823 // might be already set 
826824 }
827-  stmt .execute ("DROP USER IF EXISTS 'testPam'@'%'" );
828-  stmt .execute ("CREATE USER 'testPam'@'%' IDENTIFIED VIA pam USING 'mariadb'" );
829-  stmt .execute ("GRANT SELECT ON *.* TO 'testPam'@'%' IDENTIFIED VIA pam" );
825+ 
826+  String  pamUser  = System .getenv ("TEST_PAM_USER" );
827+  String  pamPwd  = System .getenv ("TEST_PAM_PWD" );
828+ 
829+  stmt .execute ("DROP USER IF EXISTS '"  + pamUser  + "'@'%'" );
830+  stmt .execute ("CREATE USER '"  + pamUser  + "'@'%' IDENTIFIED VIA pam USING 'mariadb'" );
831+  stmt .execute ("GRANT SELECT ON *.* TO '"  + pamUser  + "'@'%' IDENTIFIED VIA pam" );
830832 stmt .execute ("FLUSH PRIVILEGES" );
831833
832-  try  (Connection  connection  = createCon ("user=testPam&password=myPwd&restrictedAuth=dialog" )) {
833-  // must have succeeded 
834-  connection .getCatalog ();
834+  int  testPort  = this .port ;
835+  if  (System .getenv ("TEST_PAM_PORT" ) != null ) {
836+  testPort  = Integer .parseInt (System .getenv ("TEST_PAM_PORT" ));
837+  }
838+  String  connStr  =
839+  String .format (
840+  "jdbc:mariadb://%s:%s/%s?user=%s&password=%s&%s" ,
841+  hostname , testPort , database , pamUser , pamPwd , defaultOther );
842+  try  {
843+  try  (Connection  connection  =
844+  DriverManager .getConnection (connStr  + "&restrictedAuth=dialog" )) {
845+  // must have succeeded 
846+  connection .getCatalog ();
847+  }
848+  } catch  (SQLException  e ) {
849+  System .err .println ("fail with connectionString : "  + connStr  + "&restrictedAuth=dialog" );
850+  throw  e ;
835851 }
852+ 
836853 Common .assertThrowsContains (
837854 SQLException .class ,
838-  () -> createCon ( "user=testPam&password=myPwd &restrictedAuth=other" ),
855+  () -> DriverManager . getConnection ( connStr  +  " &restrictedAuth=other" ),
839856 "Client restrict authentication plugin to a limited set of authentication" );
840857
841-  stmt .execute ("drop user testPam @'%'" );
858+  stmt .execute ("drop user "   +  pamUser  +  " @'%'" );
842859 }
843860
844861 @ Nested 
@@ -943,7 +960,7 @@ public void localSocket() throws Exception {
943960 String .format (
944961 "jdbc:mariadb:///%s?user=testSocket&password=heyPassw!µ20§rd&localSocket=%s&tcpAbortiveClose&tcpKeepAlive" ,
945962 sharedConn .getCatalog (), path );
946-   System . out . println ( url ); 
963+ 
947964 try  (java .sql .Connection  connection  = DriverManager .getConnection (url )) {
948965 connection .setNetworkTimeout (null , 300 );
949966 rs  = connection .createStatement ().executeQuery ("select 1" );
0 commit comments