Skip to content

Commit ea8ff7a

Browse files
committed
implement RoundtripTestData for ScalerSpec
1 parent 701fe21 commit ea8ff7a

4 files changed

Lines changed: 63 additions & 2 deletions

File tree

crates/stackable-operator/src/crd/scaler/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,16 @@ pub enum FailedInState {
105105
/// The `post_scale` hook returned an error.
106106
PostScaling,
107107
}
108+
109+
#[cfg(test)]
110+
impl stackable_versioned::test_utils::RoundtripTestData for v1alpha1::ScalerSpec {
111+
fn roundtrip_test_data() -> Vec<Self> {
112+
crate::utils::yaml_from_str_singleton_map(indoc::indoc! {"
113+
- replicas: 0
114+
- replicas: 1
115+
- replicas: 42
116+
- replicas: 65535
117+
"})
118+
.expect("Failed to parse ScalerSpec YAML")
119+
}
120+
}

crates/stackable-versioned-macros/tests/snapshots/stackable_versioned_macros__snapshots__pass@crate_overrides_only_kube.rs.snap

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-versioned-macros/tests/snapshots/stackable_versioned_macros__snapshots__pass@scale.rs.snap

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-versioned/tests/person.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl stackable_versioned::test_utils::RoundtripTestData for v1alpha1::PersonSpec
9595
},
9696
},
9797
Self {
98-
username: "".to_string(),
98+
username: String::new(),
9999
socials: v1alpha1::Socials {
100-
email: "".to_owned(),
100+
email: String::new(),
101101
},
102102
},
103103
]

0 commit comments

Comments
 (0)