File tree Expand file tree Collapse file tree
crates/stackable-operator/src/databases Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ use crate::{
1717 } ,
1818} ;
1919
20+ pub const POSTGRES_JDBC_DRIVER_CLASS : & str = "org.postgresql.Driver" ;
21+
2022#[ derive( Debug , Snafu ) ]
2123pub enum Error {
2224 #[ snafu( display( "failed to parse connection URL" ) ) ]
@@ -78,7 +80,7 @@ impl JdbcDatabaseConnection for PostgresqlConnection {
7880 let connection_uri = connection_uri. parse ( ) . context ( ParseConnectionUrlSnafu ) ?;
7981
8082 Ok ( JdbcDatabaseConnectionDetails {
81- driver : "org.postgresql.Driver" . to_owned ( ) ,
83+ driver : POSTGRES_JDBC_DRIVER_CLASS . to_owned ( ) ,
8284 connection_uri,
8385 username_env : Some ( username_env) ,
8486 password_env : Some ( password_env) ,
@@ -189,7 +191,7 @@ mod tests {
189191 let jdbc_connection_details = postgres_connection
190192 . jdbc_connection_details ( UNIQUE_DATABASE_NAME )
191193 . expect ( "failed to get JDBC connection details" ) ;
192- assert_eq ! ( jdbc_connection_details. driver, "org.postgresql.Driver" ) ;
194+ assert_eq ! ( jdbc_connection_details. driver, POSTGRES_JDBC_DRIVER_CLASS ) ;
193195 assert_eq ! (
194196 jdbc_connection_details. connection_uri. to_string( ) ,
195197 "jdbc:postgresql://airflow-postgresql:5432/airflow"
Original file line number Diff line number Diff line change @@ -7,7 +7,10 @@ use crate::{
77 builder:: pod:: container:: ContainerBuilder ,
88 databases:: {
99 TemplatingMechanism ,
10- databases:: { postgresql:: PostgresqlConnection , redis:: RedisConnection } ,
10+ databases:: {
11+ postgresql:: { POSTGRES_JDBC_DRIVER_CLASS , PostgresqlConnection } ,
12+ redis:: RedisConnection ,
13+ } ,
1114 drivers:: {
1215 celery:: { CeleryDatabaseConnection , GenericCeleryDatabaseConnection } ,
1316 jdbc:: { GenericJdbcDatabaseConnection , JdbcDatabaseConnection } ,
@@ -70,7 +73,7 @@ fn test_dummy_jdbc_database_usage() {
7073 jdbc_connection_details. add_to_container ( & mut container_builder) ;
7174 let container = container_builder. build ( ) ;
7275
73- assert_eq ! ( jdbc_connection_details. driver, "org.postgresql.Driver" ) ;
76+ assert_eq ! ( jdbc_connection_details. driver, POSTGRES_JDBC_DRIVER_CLASS ) ;
7477 assert_eq ! (
7578 jdbc_connection_details. connection_uri. to_string( ) ,
7679 "jdbc:postgresql://my-database:1234/my_schema"
You can’t perform that action at this time.
0 commit comments