File tree Expand file tree Collapse file tree 6 files changed +86
-3
lines changed Expand file tree Collapse file tree 6 files changed +86
-3
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,8 @@ jobs:
161161 POSTGRES_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_DB
162162 POSTGRES_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_CONNECTION_NAME
163163 POSTGRES_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_PASS
164+ POSTGRES_CUSTOMER_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_CONNECTION_NAME
165+ POSTGRES_CUSTOMER_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_PASS
164166 SQLSERVER_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_CONNECTION_NAME
165167 SQLSERVER_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_USER
166168 SQLSERVER_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_PASS
@@ -188,6 +190,8 @@ jobs:
188190 POSTGRES_DB : " ${{ steps.secrets.outputs.POSTGRES_DB }}"
189191 POSTGRES_CAS_CONNECTION_NAME : " ${{ steps.secrets.outputs.POSTGRES_CAS_CONNECTION_NAME }}"
190192 POSTGRES_CAS_PASS : " ${{ steps.secrets.outputs.POSTGRES_CAS_PASS }}"
193+ POSTGRES_CUSTOMER_CAS_CONNECTION_NAME : " ${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_CONNECTION_NAME }}"
194+ POSTGRES_CUSTOMER_CAS_PASS : " ${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_PASS }}"
191195 SQLSERVER_CONNECTION_NAME : " ${{ steps.secrets.outputs.SQLSERVER_CONNECTION_NAME }}"
192196 SQLSERVER_USER : " ${{ steps.secrets.outputs.SQLSERVER_USER }}"
193197 SQLSERVER_PASS : " ${{ steps.secrets.outputs.SQLSERVER_PASS }}"
Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ export function validateCertificate(
3636 dnsName : string
3737) {
3838 return ( hostname : string , cert : tls . PeerCertificate ) : Error | undefined => {
39- if ( serverCaMode === 'GOOGLE_MANAGED_CAS_CA' ) {
39+ if (
40+ serverCaMode === 'GOOGLE_MANAGED_CAS_CA' ||
41+ serverCaMode === 'CUSTOMER_MANAGED_CAS_CA'
42+ ) {
4043 return tls . checkServerIdentity ( dnsName , cert ) ;
4144 }
4245 if ( ! cert || ! cert . subject ) {
Original file line number Diff line number Diff line change @@ -93,3 +93,29 @@ t.test(
9393 connector . close ( ) ;
9494 }
9595) ;
96+
97+ t . test (
98+ 'open connection to Customer Private CAS-based CA instance and retrieves standard pg tables' ,
99+ async t => {
100+ const connector = new Connector ( ) ;
101+ const clientOpts = await connector . getOptions ( {
102+ instanceConnectionName : String (
103+ process . env . POSTGRES_CUSTOMER_CAS_CONNECTION_NAME
104+ ) ,
105+ } ) ;
106+ const client = new Client ( {
107+ ...clientOpts ,
108+ user : String ( process . env . POSTGRES_USER ) ,
109+ password : String ( process . env . POSTGRES_CUSTOMER_CAS_PASS ) ,
110+ database : String ( process . env . POSTGRES_DB ) ,
111+ } ) ;
112+ client . connect ( ) ;
113+ const {
114+ rows : [ result ] ,
115+ } = await client . query ( 'SELECT NOW();' ) ;
116+ const returnedDate = result [ 'now' ] ;
117+ t . ok ( returnedDate . getTime ( ) , 'should have valid returned date object' ) ;
118+ await client . end ( ) ;
119+ connector . close ( ) ;
120+ }
121+ ) ;
Original file line number Diff line number Diff line change @@ -93,3 +93,29 @@ t.test(
9393 connector . close ( ) ;
9494 }
9595) ;
96+
97+ t . test (
98+ 'open connection to Customer Private CAS-based CA instance and retrieves standard pg tables' ,
99+ async t => {
100+ const connector = new Connector ( ) ;
101+ const clientOpts = await connector . getOptions ( {
102+ instanceConnectionName : String (
103+ process . env . POSTGRES_CUSTOMER_CAS_CONNECTION_NAME
104+ ) ,
105+ } ) ;
106+ const client = new Client ( {
107+ ...clientOpts ,
108+ user : String ( process . env . POSTGRES_USER ) ,
109+ password : String ( process . env . POSTGRES_CUSTOMER_CAS_PASS ) ,
110+ database : String ( process . env . POSTGRES_DB ) ,
111+ } ) ;
112+ client . connect ( ) ;
113+ const {
114+ rows : [ result ] ,
115+ } = await client . query ( 'SELECT NOW();' ) ;
116+ const returnedDate = result [ 'now' ] ;
117+ t . ok ( returnedDate . getTime ( ) , 'should have valid returned date object' ) ;
118+ await client . end ( ) ;
119+ connector . close ( ) ;
120+ }
121+ ) ;
Original file line number Diff line number Diff line change @@ -93,3 +93,29 @@ t.test(
9393 connector . close ( ) ;
9494 }
9595) ;
96+
97+ t . test (
98+ 'open connection to Customer Private CAS-based CA instance and retrieves standard pg tables' ,
99+ async t => {
100+ const connector = new Connector ( ) ;
101+ const clientOpts = await connector . getOptions ( {
102+ instanceConnectionName : String (
103+ process . env . POSTGRES_CUSTOMER_CAS_CONNECTION_NAME
104+ ) ,
105+ } ) ;
106+ const client = new Client ( {
107+ ...clientOpts ,
108+ user : String ( process . env . POSTGRES_USER ) ,
109+ password : String ( process . env . POSTGRES_CUSTOMER_CAS_PASS ) ,
110+ database : String ( process . env . POSTGRES_DB ) ,
111+ } ) ;
112+ client . connect ( ) ;
113+ const {
114+ rows : [ result ] ,
115+ } = await client . query ( 'SELECT NOW();' ) ;
116+ const returnedDate = result [ 'now' ] ;
117+ t . ok ( returnedDate . getTime ( ) , 'should have valid returned date object' ) ;
118+ await client . end ( ) ;
119+ connector . close ( ) ;
120+ }
121+ ) ;
You can’t perform that action at this time.
0 commit comments