Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions crates/stackable-operator/src/database_connections/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::BTreeMap;
use std::{collections::BTreeMap, ops::Deref};

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -26,8 +26,10 @@ enum DummyJdbcConnection {
Generic(GenericJdbcDatabaseConnection),
}

impl DummyJdbcConnection {
fn as_jdbc_database_connection(&self) -> &dyn JdbcDatabaseConnection {
impl Deref for DummyJdbcConnection {
type Target = dyn JdbcDatabaseConnection;

fn deref(&self) -> &Self::Target {
match self {
Self::Postgresql(p) => p,
Self::Generic(g) => g,
Expand All @@ -44,8 +46,10 @@ enum DummyCeleryConnection {
Generic(GenericCeleryDatabaseConnection),
}

impl DummyCeleryConnection {
fn as_celery_database_connection(&self) -> &dyn CeleryDatabaseConnection {
impl Deref for DummyCeleryConnection {
type Target = dyn CeleryDatabaseConnection;

fn deref(&self) -> &Self::Target {
match self {
Self::Postgresql(p) => p,
Self::Redis(r) => r,
Expand All @@ -66,7 +70,6 @@ fn test_dummy_jdbc_database_usage() {
});
// Apply actual config
let jdbc_connection_details = dummy_jdbc_connection
.as_jdbc_database_connection()
.jdbc_connection_details("persistence")
.unwrap();
let mut container_builder = ContainerBuilder::new("my-container").unwrap();
Expand Down Expand Up @@ -100,7 +103,6 @@ fn test_dummy_celery_database_usage() {
});
// Apply actual config
let celery_connection_details = dummy_celery_connection
.as_celery_database_connection()
.celery_connection_details_with_templating(
"worker_queue",
&TemplatingMechanism::BashEnvSubstitution,
Expand Down
Loading