Skip to content

Commit 968a52c

Browse files
committed
test(stackable-versioned): Add additional status field
This also removes various unused derives to simplify the integration test.
1 parent dc46e64 commit 968a52c

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

crates/stackable-versioned/tests/inputs/roundtrip/person_v3.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
}
2121
},
2222
"status": {
23+
"alive": true,
2324
"changedValues": {
2425
"downgrades": {},
2526
"upgrades": {}

crates/stackable-versioned/tests/person.rs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,8 @@ pub fn roundtrip_conversion_review(
4848
options(k8s(experimental_conversion_tracking))
4949
)]
5050
pub mod versioned {
51-
#[versioned(crd(group = "test.stackable.tech"))]
52-
#[derive(
53-
Clone,
54-
Debug,
55-
Eq,
56-
Hash,
57-
Ord,
58-
PartialEq,
59-
PartialOrd,
60-
CustomResource,
61-
Deserialize,
62-
JsonSchema,
63-
Serialize,
64-
)]
51+
#[versioned(crd(group = "test.stackable.tech", status = "PersonStatus"))]
52+
#[derive(Clone, Debug, CustomResource, Deserialize, JsonSchema, Serialize)]
6553
#[serde(rename_all = "camelCase")]
6654
pub struct PersonSpec {
6755
username: String,
@@ -85,9 +73,7 @@ pub mod versioned {
8573
socials: Socials,
8674
}
8775

88-
#[derive(
89-
Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Deserialize, Serialize, JsonSchema,
90-
)]
76+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
9177
pub struct Socials {
9278
email: String,
9379

@@ -96,9 +82,18 @@ pub mod versioned {
9682
}
9783
}
9884

99-
#[derive(
100-
Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, JsonSchema, Serialize,
101-
)]
85+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
86+
pub struct PersonStatus {
87+
pub alive: bool,
88+
}
89+
90+
impl Default for PersonStatus {
91+
fn default() -> Self {
92+
Self { alive: true }
93+
}
94+
}
95+
96+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
10297
#[serde(rename_all = "PascalCase")]
10398
pub enum Gender {
10499
Unknown,

crates/stackable-versioned/tests/snapshots/conversions__pass@persons_to_v1alpha1.json.snap

Lines changed: 4 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/snapshots/conversions__pass@persons_to_v3.json.snap

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

0 commit comments

Comments
 (0)