Skip to content

Commit 78ca3af

Browse files
authored
Merge branch 'main' into fix/clashing-volumes-and-mounts-2
2 parents ddfc266 + 7fe86d5 commit 78ca3af

File tree

35 files changed

+157
-162
lines changed

35 files changed

+157
-162
lines changed

crates/stackable-certs/src/ca/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,18 @@ fn format_leaf_certificate_subject(name: &str, scope: &str) -> Result<Name> {
467467
}
468468

469469
#[cfg(test)]
470-
mod test {
471-
470+
mod tests {
472471
use super::*;
473472

474473
#[tokio::test]
475-
async fn test_rsa_key_generation() {
474+
async fn rsa_key_generation() {
476475
let mut ca = CertificateAuthority::new_rsa().unwrap();
477476
ca.generate_rsa_leaf_certificate("Airflow", "pod", Duration::from_secs(3600))
478477
.unwrap();
479478
}
480479

481480
#[tokio::test]
482-
async fn test_ecdsa_key_generation() {
481+
async fn ecdsa_key_generation() {
483482
let mut ca = CertificateAuthority::new_ecdsa().unwrap();
484483
ca.generate_ecdsa_leaf_certificate("Airflow", "pod", Duration::from_secs(3600))
485484
.unwrap();

crates/stackable-operator/src/builder/configmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ mod tests {
6969
use std::collections::BTreeMap;
7070

7171
#[test]
72-
fn test_configmap_builder() {
72+
fn configmap_builder() {
7373
let mut data = BTreeMap::new();
7474
data.insert("foo".to_string(), "bar".to_string());
7575
let configmap = ConfigMapBuilder::new()

crates/stackable-operator/src/builder/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ mod tests {
130130
use crate::builder::pod::PodBuilder;
131131

132132
#[test]
133-
fn test_event_builder() {
133+
fn event_builder() {
134134
let pod = PodBuilder::new()
135135
.metadata_builder(|builder| builder.name("testpod"))
136136
.build()

crates/stackable-operator/src/builder/meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ mod tests {
316316
use k8s_openapi::api::core::v1::Pod;
317317

318318
#[test]
319-
fn test_objectmeta_builder() {
319+
fn objectmeta_builder() {
320320
let mut pod = Pod::default();
321321
pod.metadata.name = Some("pod".to_string());
322322
pod.metadata.uid = Some("uid".to_string());

crates/stackable-operator/src/builder/pdb.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl PodDisruptionBudgetBuilder<ObjectMeta, LabelSelector, PodDisruptionBudgetCo
198198
}
199199

200200
#[cfg(test)]
201-
mod test {
201+
mod tests {
202202
use std::collections::BTreeMap;
203203

204204
use k8s_openapi::{
@@ -214,7 +214,7 @@ mod test {
214214
use super::PodDisruptionBudgetBuilder;
215215

216216
#[test]
217-
pub fn test_normal_build() {
217+
pub fn normal_build() {
218218
#[allow(deprecated)]
219219
let pdb = PodDisruptionBudgetBuilder::new()
220220
.new_with_metadata(
@@ -255,7 +255,7 @@ mod test {
255255
}
256256

257257
#[test]
258-
pub fn test_build_from_role() {
258+
pub fn build_from_role() {
259259
#[derive(
260260
Clone, CustomResource, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize,
261261
)]
@@ -273,10 +273,12 @@ mod test {
273273
",
274274
)
275275
.unwrap();
276+
276277
let app_name = "trino";
277278
let role = "worker";
278279
let operator_name = "trino.stackable.tech";
279280
let controller_name = "trino-operator-trino-controller";
281+
280282
let pdb = PodDisruptionBudgetBuilder::new_with_role(
281283
&trino,
282284
app_name,

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ mod tests {
416416
};
417417

418418
#[test]
419-
fn test_container_builder() {
419+
fn builder() {
420420
let container_port: i32 = 10000;
421421
let container_port_name = "foo_port_name";
422422
let container_port_1: i32 = 20000;
@@ -477,7 +477,7 @@ mod tests {
477477
}
478478

479479
#[test]
480-
fn test_container_builder_lifecycle() {
480+
fn builder_lifecycle() {
481481
let post_start = LifecycleHandler {
482482
exec: Some(ExecAction {
483483
command: Some(vec!["hello".to_string(), "world".to_string()]),
@@ -505,7 +505,7 @@ mod tests {
505505
}
506506

507507
#[test]
508-
fn test_container_port_builder() {
508+
fn port_builder() {
509509
let port: i32 = 10000;
510510
let name = "FooBar";
511511
let protocol = "http";
@@ -526,15 +526,16 @@ mod tests {
526526
}
527527

528528
#[test]
529-
pub fn test_field_ref_env_var_serialization() {
529+
pub fn field_ref_env_var_serialization() {
530530
assert_eq!(
531531
"metadata.labels['some-label-name']",
532532
FieldPathEnvVar::Labels("some-label-name".to_string()).to_string()
533533
);
534534
}
535535

536+
// TODO (@Techassi): Use rstest for name validation below
536537
#[test]
537-
fn test_container_name_max_len() {
538+
fn name_max_len() {
538539
let long_container_name =
539540
"lengthexceededlengthexceededlengthexceededlengthexceededlengthex";
540541
assert_eq!(long_container_name.len(), 64); // 63 characters is the limit for container names
@@ -559,12 +560,12 @@ mod tests {
559560
}
560561

561562
#[test]
562-
fn test_container_name_alphabet_only() {
563+
fn name_alphabet_only() {
563564
ContainerBuilder::new("okname").unwrap();
564565
}
565566

566567
#[test]
567-
fn test_container_name_hyphen() {
568+
fn name_hyphen() {
568569
assert!(ContainerBuilder::new("name-with-hyphen").is_ok());
569570
assert_container_builder_err(
570571
ContainerBuilder::new("ends-with-hyphen-"),
@@ -577,12 +578,12 @@ mod tests {
577578
}
578579

579580
#[test]
580-
fn test_container_name_contains_number() {
581+
fn name_contains_number() {
581582
assert!(ContainerBuilder::new("1name-0-name1").is_ok());
582583
}
583584

584585
#[test]
585-
fn test_container_name_contains_underscore() {
586+
fn name_contains_underscore() {
586587
assert!(ContainerBuilder::new("name_name").is_err());
587588
assert_container_builder_err(
588589
ContainerBuilder::new("name_name"),
@@ -591,7 +592,7 @@ mod tests {
591592
}
592593

593594
#[test]
594-
fn test_container_cpu_and_memory_resource_requirements() {
595+
fn cpu_and_memory_resource_requirements() {
595596
let resources = ResourceRequirementsBuilder::new()
596597
.with_cpu_request("2000m")
597598
.with_cpu_limit("3000m")

crates/stackable-operator/src/builder/pod/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ mod tests {
690690
}
691691

692692
#[rstest]
693-
fn test_pod_builder_pod_name() {
693+
fn builder_pod_name() {
694694
let pod = PodBuilder::new()
695695
.metadata_builder(|builder| builder.name("foo"))
696696
.build()
@@ -700,7 +700,7 @@ mod tests {
700700
}
701701

702702
#[rstest]
703-
fn test_pod_builder(pod_affinity: PodAffinity, dummy_container: Container) {
703+
fn builder(pod_affinity: PodAffinity, dummy_container: Container) {
704704
let init_container = ContainerBuilder::new("init-containername")
705705
.expect("ContainerBuilder not created")
706706
.image("stackable/zookeeper:2.4.14")
@@ -752,7 +752,7 @@ mod tests {
752752
}
753753

754754
#[rstest]
755-
fn test_pod_builder_image_pull_secrets(mut pod_builder_with_name_and_container: PodBuilder) {
755+
fn builder_image_pull_secrets(mut pod_builder_with_name_and_container: PodBuilder) {
756756
let pod = pod_builder_with_name_and_container
757757
.image_pull_secrets(vec!["company-registry-secret".to_string()].into_iter())
758758
.build()
@@ -767,7 +767,7 @@ mod tests {
767767
}
768768

769769
#[rstest]
770-
fn test_pod_builder_restart_policy(mut pod_builder_with_name_and_container: PodBuilder) {
770+
fn builder_restart_policy(mut pod_builder_with_name_and_container: PodBuilder) {
771771
let pod = pod_builder_with_name_and_container
772772
.restart_policy("Always")
773773
.build()
@@ -776,7 +776,7 @@ mod tests {
776776
}
777777

778778
#[test]
779-
fn test_pod_builder_too_long_termination_grace_period() {
779+
fn builder_too_long_termination_grace_period() {
780780
let too_long_duration = Duration::from_secs(i64::MAX as u64 + 1);
781781
let mut pod_builder = PodBuilder::new();
782782

crates/stackable-operator/src/builder/pod/resources.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ impl ResourceRequirementsBuilder<Quantity, Quantity, Quantity, Quantity> {
252252
}
253253

254254
#[cfg(test)]
255-
mod test {
255+
mod tests {
256256
use super::*;
257257

258258
#[test]
259-
fn test_builder() {
259+
fn builder() {
260260
let resources = ResourceRequirements {
261261
limits: Some(
262262
[

crates/stackable-operator/src/builder/pod/security.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ mod tests {
339339
use k8s_openapi::api::core::v1::{PodSecurityContext, SELinuxOptions, SeccompProfile, Sysctl};
340340

341341
#[test]
342-
fn test_security_context_builder() {
342+
fn security_context_builder() {
343343
let mut builder = PodSecurityContextBuilder::new();
344344
let context = builder
345345
.fs_group(1000)

crates/stackable-operator/src/builder/pod/volume.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ mod tests {
558558
use std::collections::BTreeMap;
559559

560560
#[test]
561-
fn test_volume_builder() {
561+
fn builder() {
562562
let mut volume_builder = VolumeBuilder::new("name");
563563
volume_builder.with_config_map("configmap");
564564
let vol = volume_builder.build();
@@ -595,7 +595,7 @@ mod tests {
595595
}
596596

597597
#[test]
598-
fn test_volume_mount_builder() {
598+
fn mount_builder() {
599599
let mut volume_mount_builder = VolumeMountBuilder::new("name", "mount_path");
600600
volume_mount_builder
601601
.mount_propagation("mount_propagation")
@@ -614,7 +614,7 @@ mod tests {
614614
}
615615

616616
#[test]
617-
fn test_listener_operator_volume_source_builder() {
617+
fn listener_operator_volume_source_builder() {
618618
let labels: Labels = Labels::try_from(BTreeMap::<String, String>::new()).unwrap();
619619

620620
let builder = ListenerOperatorVolumeSourceBuilder::new(

crates/stackable-operator/src/cli.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ mod tests {
303303
DEPLOY_FILE_PATH
304304
)]
305305
#[case(None, vec!["bad", DEFAULT_FILE_PATH], DEFAULT_FILE_PATH, DEFAULT_FILE_PATH)]
306-
fn test_resolve_path_good(
306+
fn resolve_path_good(
307307
#[case] user_provided_path: Option<&str>,
308308
#[case] default_locations: Vec<&str>,
309309
#[case] path_to_create: &str,
@@ -343,12 +343,12 @@ mod tests {
343343

344344
#[test]
345345
#[should_panic]
346-
fn test_resolve_path_user_path_not_existing() {
346+
fn resolve_path_user_path_not_existing() {
347347
resolve_path(Some(USER_PROVIDED_PATH.as_ref()), &[DEPLOY_FILE_PATH]).unwrap();
348348
}
349349

350350
#[test]
351-
fn test_resolve_path_nothing_found_errors() {
351+
fn resolve_path_nothing_found_errors() {
352352
if let Err(Error::RequiredFileMissing { search_path }) =
353353
resolve_path(None, &[DEPLOY_FILE_PATH, DEFAULT_FILE_PATH])
354354
{
@@ -365,7 +365,7 @@ mod tests {
365365
}
366366

367367
#[test]
368-
fn test_product_operator_run_watch_namespace() {
368+
fn product_operator_run_watch_namespace() {
369369
// clean env var to not interfere if already set
370370
env::remove_var(WATCH_NAMESPACE);
371371

crates/stackable-operator/src/commons/affinity.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mod tests {
143143
use super::*;
144144

145145
#[test]
146-
fn test_affinity_merge_new_attributes() {
146+
fn merge_new_attributes() {
147147
let default_affinity = StackableAffinityFragment {
148148
pod_affinity: None,
149149
pod_anti_affinity: Some(PodAntiAffinity {
@@ -254,7 +254,7 @@ mod tests {
254254
}
255255

256256
#[test]
257-
fn test_affinity_merge_overwrite_existing_attribute() {
257+
fn merge_overwrite_existing_attribute() {
258258
let default_affinity = StackableAffinityFragment {
259259
pod_affinity: None,
260260
pod_anti_affinity: Some(PodAntiAffinity {
@@ -319,7 +319,7 @@ mod tests {
319319
}
320320

321321
#[test]
322-
fn test_affinity_between_role_pods() {
322+
fn between_role_pods() {
323323
let app_name = "kafka";
324324
let cluster_name = "simple-kafka";
325325
let role = "broker";
@@ -352,7 +352,7 @@ mod tests {
352352
}
353353

354354
#[test]
355-
fn test_affinity_between_cluster_pods() {
355+
fn between_cluster_pods() {
356356
let app_name = "kafka";
357357
let cluster_name = "simple-kafka";
358358

crates/stackable-operator/src/commons/authentication/ldap.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ impl Default for FieldNames {
225225
}
226226

227227
#[cfg(test)]
228-
mod test {
228+
mod tests {
229229
use super::*;
230230

231231
#[test]
232-
fn test_ldap_minimal() {
232+
fn minimal() {
233233
let ldap = serde_yaml::from_str::<AuthenticationProvider>(
234234
"
235235
hostname: my.ldap.server
@@ -243,7 +243,7 @@ mod test {
243243
}
244244

245245
#[test]
246-
fn test_ldap_with_bind_credentials() {
246+
fn with_bind_credentials() {
247247
let _ldap = serde_yaml::from_str::<AuthenticationProvider>(
248248
"
249249
hostname: my.ldap.server
@@ -257,7 +257,7 @@ mod test {
257257
}
258258

259259
#[test]
260-
fn test_ldap_full() {
260+
fn full() {
261261
let input = r#"
262262
hostname: my.ldap.server
263263
port: 42
@@ -284,6 +284,7 @@ mod test {
284284
ldap.tls.tls_ca_cert_mount_path(),
285285
Some("/stackable/secrets/ldap-ca-cert/ca.crt".to_string())
286286
);
287+
287288
let (tls_volumes, tls_mounts) = ldap.tls.volumes_and_mounts().unwrap();
288289
assert_eq!(
289290
tls_volumes,
@@ -311,6 +312,7 @@ mod test {
311312
"/stackable/secrets/openldap-bind-credentials/password".to_string()
312313
))
313314
);
315+
314316
let (ldap_volumes, ldap_mounts) = ldap.volumes_and_mounts().unwrap();
315317
assert_eq!(
316318
ldap_volumes,

0 commit comments

Comments
 (0)