properly handling patch updates
Some checks failed
CI / Clippy (push) Failing after 3m6s
CI / Rustfmt (push) Failing after 3m9s
CI / Cargo Audit & Deny (push) Successful in 5m2s
CI / Tests (push) Successful in 8m15s
CI / Security Blocking Checks (push) Successful in 10s
CI / Web Advisory Checks (push) Successful in 1m4s
CI / Web Blocking Checks (push) Failing after 4m52s
Publish Images And Chart / Resolve Publish Metadata (push) Successful in 2s
CI / Security Advisory Checks (push) Successful in 1m31s
Publish Images And Chart / Publish init-user (push) Failing after 30s
Publish Images And Chart / Publish init-packs (push) Failing after 1m41s
Publish Images And Chart / Publish migrations (push) Failing after 10s
Publish Images And Chart / Publish web (push) Failing after 11s
Publish Images And Chart / Publish sensor (push) Failing after 32s
Publish Images And Chart / Publish worker (push) Failing after 11s
Publish Images And Chart / Publish executor (push) Failing after 11s
Publish Images And Chart / Publish notifier (push) Failing after 9s
Publish Images And Chart / Publish api (push) Failing after 31s
Publish Images And Chart / Publish Helm Chart (push) Has been skipped

This commit is contained in:
2026-03-17 12:17:58 -05:00
parent 643023b6d5
commit f96861d417
136 changed files with 3782 additions and 1553 deletions

View File

@@ -6,7 +6,7 @@
use attune_common::repositories::runtime::{
CreateRuntimeInput, RuntimeRepository, UpdateRuntimeInput,
};
use attune_common::repositories::{Create, Delete, FindById, FindByRef, List, Update};
use attune_common::repositories::{Create, Delete, FindById, FindByRef, List, Patch, Update};
use serde_json::json;
use sqlx::PgPool;
use std::collections::hash_map::DefaultHasher;
@@ -259,14 +259,14 @@ async fn test_update_runtime() {
.expect("Failed to create runtime");
let update_input = UpdateRuntimeInput {
description: Some("Updated description".to_string()),
description: Some(Patch::Set("Updated description".to_string())),
name: Some("updated_name".to_string()),
distributions: Some(json!({
"linux": { "supported": false }
})),
installation: Some(json!({
installation: Some(Patch::Set(json!({
"method": "npm"
})),
}))),
execution_config: None,
};
@@ -275,10 +275,10 @@ async fn test_update_runtime() {
.expect("Failed to update runtime");
assert_eq!(updated.id, created.id);
assert_eq!(updated.description, update_input.description);
assert_eq!(updated.description, Some("Updated description".to_string()));
assert_eq!(updated.name, update_input.name.unwrap());
assert_eq!(updated.distributions, update_input.distributions.unwrap());
assert_eq!(updated.installation, update_input.installation);
assert_eq!(updated.installation, Some(json!({ "method": "npm" })));
assert!(updated.updated > created.updated);
}
@@ -294,7 +294,7 @@ async fn test_update_runtime_partial() {
.expect("Failed to create runtime");
let update_input = UpdateRuntimeInput {
description: Some("Only description changed".to_string()),
description: Some(Patch::Set("Only description changed".to_string())),
name: None,
distributions: None,
installation: None,
@@ -305,7 +305,10 @@ async fn test_update_runtime_partial() {
.await
.expect("Failed to update runtime");
assert_eq!(updated.description, update_input.description);
assert_eq!(
updated.description,
Some("Only description changed".to_string())
);
assert_eq!(updated.name, created.name);
assert_eq!(updated.distributions, created.distributions);
assert_eq!(updated.installation, created.installation);
@@ -610,7 +613,7 @@ async fn test_update_changes_timestamp() {
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
let update_input = UpdateRuntimeInput {
description: Some("Updated".to_string()),
description: Some(Patch::Set("Updated".to_string())),
..Default::default()
};