Skip to content

Commit 28d8ce0

Browse files
committed
fix(tests): consolite example cluster defintion
1 parent bbfe09f commit 28d8ce0

2 files changed

Lines changed: 23 additions & 38 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,28 @@ pub(crate) mod test_support {
624624
use super::{ValidatedCluster, dereference::DereferencedObjects, validate::validate_cluster};
625625
use crate::crd::v1alpha1;
626626

627+
/// Minimal Derby-backed `HiveCluster` fixture shared across the crate's tests.
628+
///
629+
/// Includes a `uid` so owner references can be derived from it.
630+
pub const DERBY_YAML: &str = r#"
631+
apiVersion: hive.stackable.tech/v1alpha1
632+
kind: HiveCluster
633+
metadata:
634+
name: simple-hive
635+
namespace: default
636+
uid: 12345678-1234-1234-1234-123456789012
637+
spec:
638+
image:
639+
productVersion: "4.0.0"
640+
clusterConfig:
641+
metadataDatabase:
642+
derby: {}
643+
metastore:
644+
roleGroups:
645+
default:
646+
replicas: 1
647+
"#;
648+
627649
pub fn minimal_hive(yaml: &str) -> v1alpha1::HiveCluster {
628650
yaml_from_str_singleton_map(yaml).expect("invalid test HiveCluster YAML")
629651
}
@@ -655,25 +677,6 @@ mod tests {
655677

656678
use super::{RoleGroupName, test_support::*};
657679

658-
const DERBY_YAML: &str = r#"
659-
apiVersion: hive.stackable.tech/v1alpha1
660-
kind: HiveCluster
661-
metadata:
662-
name: simple-hive
663-
namespace: default
664-
uid: 12345678-1234-1234-1234-123456789012
665-
spec:
666-
image:
667-
productVersion: 4.2.0
668-
clusterConfig:
669-
metadataDatabase:
670-
derby: {}
671-
metastore:
672-
roleGroups:
673-
default:
674-
replicas: 1
675-
"#;
676-
677680
#[test]
678681
fn object_meta_sets_namespace_owner_and_recommended_labels() {
679682
let hive = minimal_hive(DERBY_YAML);

rust/operator-binary/src/controller/build/properties/mod.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,13 @@ pub(crate) mod test_support {
4242
use std::collections::BTreeMap;
4343

4444
use crate::{
45-
controller::ValidatedClusterConfig,
45+
controller::{ValidatedClusterConfig, test_support::DERBY_YAML},
4646
crd::{
4747
databases::{MetadataDatabaseConnection, derby_driver_class},
4848
v1alpha1,
4949
},
5050
};
5151

52-
pub const DERBY_YAML: &str = r#"
53-
apiVersion: hive.stackable.tech/v1alpha1
54-
kind: HiveCluster
55-
metadata:
56-
name: simple-hive
57-
namespace: default
58-
spec:
59-
image:
60-
productVersion: "4.0.0"
61-
clusterConfig:
62-
metadataDatabase:
63-
derby: {}
64-
metastore:
65-
roleGroups:
66-
default:
67-
replicas: 1
68-
"#;
69-
7052
/// Build a minimal Derby-backed [`ValidatedClusterConfig`] for builder tests.
7153
pub fn derby_cluster_config() -> ValidatedClusterConfig {
7254
let hive: v1alpha1::HiveCluster =

0 commit comments

Comments
 (0)