@@ -131,6 +131,10 @@ pub struct Config {
131131 /// The port for the internal endpoints of the materialize instance that
132132 /// testdrive will connect to via HTTP.
133133 pub materialize_internal_http_port : u16 ,
134+ /// The connection string for the password-protected SQL endpoint.
135+ pub materialize_password_sql_url : Option < tokio_postgres:: Config > ,
136+ /// The connection string for the SASL-protected SQL endpoint.
137+ pub materialize_sasl_sql_url : Option < tokio_postgres:: Config > ,
134138 /// Session parameters to set after connecting to materialize.
135139 pub materialize_params : Vec < ( String , String ) > ,
136140 /// An optional catalog configuration.
@@ -191,6 +195,8 @@ pub struct MaterializeState {
191195 http_addr : String ,
192196 internal_sql_addr : String ,
193197 internal_http_addr : String ,
198+ password_sql_addr : Option < String > ,
199+ sasl_sql_addr : Option < String > ,
194200 user : String ,
195201 pgclient : tokio_postgres:: Client ,
196202 environment_id : EnvironmentId ,
@@ -334,6 +340,19 @@ impl State {
334340 "testdrive.materialize-user" . into ( ) ,
335341 self . materialize . user . clone ( ) ,
336342 ) ;
343+ // Add password-protected connection variables if they exist
344+ if let Some ( ref password_sql_addr) = self . materialize . password_sql_addr {
345+ self . cmd_vars . insert (
346+ "testdrive.materialize-password-sql-addr" . into ( ) ,
347+ password_sql_addr. clone ( ) ,
348+ ) ;
349+ }
350+ if let Some ( ref sasl_sql_addr) = self . materialize . sasl_sql_addr {
351+ self . cmd_vars . insert (
352+ "testdrive.materialize-sasl-sql-addr" . into ( ) ,
353+ sasl_sql_addr. clone ( ) ,
354+ ) ;
355+ }
337356 self . cmd_vars . insert (
338357 "testdrive.fivetran-destination-url" . into ( ) ,
339358 self . fivetran_destination_url . clone ( ) ,
@@ -1130,6 +1149,26 @@ async fn create_materialize_state(
11301149 materialize_internal_url. host_str( ) . unwrap( ) ,
11311150 config. materialize_internal_http_port
11321151 ) ;
1152+ let materialize_password_sql_addr = if let Some ( ref password_config) = config. materialize_password_sql_url {
1153+ let password_url = util:: postgres:: config_url ( password_config) ?;
1154+ Some ( format ! (
1155+ "{}:{}" ,
1156+ password_url. host_str( ) . unwrap( ) ,
1157+ password_url. port( ) . unwrap( )
1158+ ) )
1159+ } else {
1160+ None
1161+ } ;
1162+ let materialize_sasl_sql_addr = if let Some ( ref sasl_config) = config. materialize_sasl_sql_url {
1163+ let sasl_url = util:: postgres:: config_url ( sasl_config) ?;
1164+ Some ( format ! (
1165+ "{}:{}" ,
1166+ sasl_url. host_str( ) . unwrap( ) ,
1167+ sasl_url. port( ) . unwrap( )
1168+ ) )
1169+ } else {
1170+ None
1171+ } ;
11331172 let environment_id = pgclient
11341173 . query_one ( "SELECT mz_environment_id()" , & [ ] )
11351174 . await ?
@@ -1151,6 +1190,8 @@ async fn create_materialize_state(
11511190 http_addr : materialize_http_addr,
11521191 internal_sql_addr : materialize_internal_sql_addr,
11531192 internal_http_addr : materialize_internal_http_addr,
1193+ password_sql_addr : materialize_password_sql_addr,
1194+ sasl_sql_addr : materialize_sasl_sql_addr,
11541195 user : materialize_user,
11551196 pgclient,
11561197 environment_id,
0 commit comments