Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(status)!: rename compensating and ready status #223

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ test/e2e_log/
*.dump

# Thanks MacOS
.DS_Store
.DS_Store

# Ignore IDE specific files
.idea/
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
Loading