Share address and TLS types across backend configurations
This commit is contained in:
@@ -229,3 +229,35 @@ fn missing_binding_target_is_rejected_for_any_role() {
|
||||
if role == "attachments" && target == "missing")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn s3_uses_shared_address_and_endpoint_tls() {
|
||||
use clusters::{ConfigFormat, ObjectStorage};
|
||||
|
||||
let config = DeploymentConfig::parse(
|
||||
include_str!("../../../deploy/kubernetes/multi-storage.yaml"),
|
||||
ConfigFormat::Yaml,
|
||||
)
|
||||
.unwrap();
|
||||
let Some(Resource::ObjectStore(store)) = config.resource("attachment-store") else {
|
||||
panic!("expected object storage configuration");
|
||||
};
|
||||
assert_eq!(store.tls().unwrap(), Tls::VerifyFull);
|
||||
|
||||
for (url, expected) in [
|
||||
("https://objects.example.test", Tls::VerifyFull),
|
||||
("http://objects.example.test", Tls::Disabled),
|
||||
] {
|
||||
let store = ObjectStorage {
|
||||
endpoint: Some(url.into()),
|
||||
..store.clone()
|
||||
};
|
||||
assert_eq!(store.endpoint.as_ref().unwrap().connection_string(), url);
|
||||
assert_eq!(store.tls().unwrap(), expected);
|
||||
}
|
||||
let store = ObjectStorage {
|
||||
endpoint: Some("https://user@objects.example.test".into()),
|
||||
..store.clone()
|
||||
};
|
||||
assert!(matches!(store.tls(), Err(ConfigError::ObjectStorage)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user