Skip to content

Commit

Permalink
feat(status)!: rename compensating and ready status
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <[email protected]>

chore: update to lowercase

Signed-off-by: Brooks Townsend <[email protected]>
  • Loading branch information
brooksmtownsend committed Nov 28, 2023
1 parent 48bd548 commit 86fdecc
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/scaler/daemonscaler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ mod test {
assert_eq!(cmds.len(), 1);
assert_eq!(
blobby_daemonscaler.status().await.status_type,
StatusType::Compensating
StatusType::Reconciling
);

for cmd in cmds.iter() {
Expand Down Expand Up @@ -1030,7 +1030,7 @@ mod test {

assert_eq!(
blobby_daemonscaler.status().await.status_type,
StatusType::Ready
StatusType::Deployed
);

Ok(())
Expand Down
28 changes: 16 additions & 12 deletions src/server/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl StatusInfo {

pub fn ready(message: &str) -> Self {
StatusInfo {
status_type: StatusType::Ready,
status_type: StatusType::Deployed,
message: message.to_owned(),
}
}
Expand All @@ -219,7 +219,7 @@ impl StatusInfo {

pub fn compensating(message: &str) -> Self {
StatusInfo {
status_type: StatusType::Compensating,
status_type: StatusType::Reconciling,
message: message.to_owned(),
}
}
Expand All @@ -231,8 +231,10 @@ impl StatusInfo {
pub enum StatusType {
#[default]
Undeployed,
Compensating,
Ready,
#[serde(alias = "compensating")]
Reconciling,
#[serde(alias = "ready")]
Deployed,
Failed,
}

Expand All @@ -256,8 +258,8 @@ impl std::ops::Add for StatusType {
// If anything is undeployed, the whole thing is
(Self::Undeployed, _) => Self::Undeployed,
(_, Self::Undeployed) => Self::Undeployed,
(Self::Compensating, _) => Self::Compensating,
(_, Self::Compensating) => Self::Compensating,
(Self::Reconciling, _) => Self::Reconciling,
(_, Self::Reconciling) => Self::Reconciling,
_ => unreachable!("aggregating StatusType failure. This is programmer error"),
}
}
Expand All @@ -278,8 +280,10 @@ mod test {
#[test]
fn test_status_aggregate() {
assert!(matches!(
[StatusType::Ready, StatusType::Ready].into_iter().sum(),
StatusType::Ready
[StatusType::Deployed, StatusType::Deployed]
.into_iter()
.sum(),
StatusType::Deployed
));

assert!(matches!(
Expand All @@ -297,23 +301,23 @@ mod test {
));

assert!(matches!(
[StatusType::Compensating, StatusType::Undeployed]
[StatusType::Reconciling, StatusType::Undeployed]
.into_iter()
.sum(),
StatusType::Undeployed
));

assert!(matches!(
[StatusType::Ready, StatusType::Undeployed]
[StatusType::Deployed, StatusType::Undeployed]
.into_iter()
.sum(),
StatusType::Undeployed
));

assert!(matches!(
[
StatusType::Ready,
StatusType::Compensating,
StatusType::Deployed,
StatusType::Reconciling,
StatusType::Undeployed,
StatusType::Failed
]
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_multiple_hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async fn test_no_requirements(client_info: &ClientInfo) {
);

// Once manifest is deployed, first status should be compensating
check_status(&stream, "default", "echo-simple", StatusType::Compensating)
check_status(&stream, "default", "echo-simple", StatusType::Reconciling)
.await
.unwrap();

Expand Down Expand Up @@ -165,7 +165,7 @@ async fn test_no_requirements(client_info: &ClientInfo) {
)
}

check_status(&stream, "default", "echo-simple", StatusType::Ready)
check_status(&stream, "default", "echo-simple", StatusType::Deployed)
.await
.unwrap();

Expand Down
8 changes: 4 additions & 4 deletions tests/e2e_multitenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ async fn test_basic_separation(client_info: &ClientInfo) -> anyhow::Result<()> {
&stream,
LATTICE_EAST,
"echo-simple",
StatusType::Compensating,
StatusType::Reconciling,
)
.await
.unwrap();
check_status(
&stream,
LATTICE_WEST,
"messaging-simple",
StatusType::Compensating,
StatusType::Reconciling,
)
.await
.unwrap();
Expand Down Expand Up @@ -299,10 +299,10 @@ async fn test_basic_separation(client_info: &ClientInfo) -> anyhow::Result<()> {
)
}

check_status(&stream, LATTICE_EAST, "echo-simple", StatusType::Ready)
check_status(&stream, LATTICE_EAST, "echo-simple", StatusType::Deployed)
.await
.unwrap();
check_status(&stream, LATTICE_WEST, "messaging-simple", StatusType::Ready)
check_status(&stream, LATTICE_WEST, "messaging-simple", StatusType::Deployed)
.await
.unwrap();

Expand Down
12 changes: 6 additions & 6 deletions tests/e2e_upgrades.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
);

// Once manifest is deployed, first status should be compensating
check_status(&stream, "default", "updateapp", StatusType::Compensating)
check_status(&stream, "default", "updateapp", StatusType::Reconciling)
.await
.unwrap();

Expand Down Expand Up @@ -180,7 +180,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
)
}

check_status(&stream, "default", "updateapp", StatusType::Ready)
check_status(&stream, "default", "updateapp", StatusType::Deployed)
.await
.unwrap();

Expand Down Expand Up @@ -209,7 +209,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
);

// Once manifest is updated, status should be compensating
check_status(&stream, "default", "updateapp", StatusType::Compensating)
check_status(&stream, "default", "updateapp", StatusType::Reconciling)
.await
.unwrap();

Expand Down Expand Up @@ -292,7 +292,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
)
}

check_status(&stream, "default", "updateapp", StatusType::Ready)
check_status(&stream, "default", "updateapp", StatusType::Deployed)
.await
.unwrap();

Expand Down Expand Up @@ -321,7 +321,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
);

// Once manifest is updated, status should be compensating
check_status(&stream, "default", "updateapp", StatusType::Compensating)
check_status(&stream, "default", "updateapp", StatusType::Reconciling)
.await
.unwrap();

Expand Down Expand Up @@ -404,7 +404,7 @@ async fn test_upgrade(client_info: &ClientInfo) {
)
}

check_status(&stream, "default", "updateapp", StatusType::Ready)
check_status(&stream, "default", "updateapp", StatusType::Deployed)
.await
.unwrap();

Expand Down

0 comments on commit 86fdecc

Please sign in to comment.