feat: qualify bound configure-only recovery runtime on cloud VM
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -3,6 +3,46 @@ use openssl::{pkey::PKey, sign::Signer};
|
||||
use rmm_domain::jobs::{Action, encode};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
fn configure_only_is_explicit_native_recovery_and_never_install_acceptance() {
|
||||
let (config, mut m) = manifest(true);
|
||||
m.schema_version = 4;
|
||||
m.native_recovery = Some(rmm_domain::apt_transaction::AptNativeRecovery {
|
||||
schema_version: 1,
|
||||
previous_grant_id: Uuid::new_v4(),
|
||||
previous_attempt_id: Uuid::new_v4(),
|
||||
partial_proof_sha256: hash(b"partial"),
|
||||
});
|
||||
m.resolved_apt_transaction.schema_version = 2;
|
||||
m.resolved_apt_transaction.operation =
|
||||
Some(rmm_domain::apt_transaction::AptTransactionOperation::ConfigureOnly);
|
||||
m.resolved_apt_transaction.packages[0].old_version = Some("1.0".into());
|
||||
m.transaction_bytes = serde_json::to_vec(&m.resolved_apt_transaction).unwrap();
|
||||
m.transaction_sha256 = hash(&m.transaction_bytes);
|
||||
validate_manifest(&m, "apt_native_acceptance", &config).unwrap();
|
||||
assert!(validate_manifest(&m, "ensure_package", &config).is_err());
|
||||
let mut evidence = serde_json::json!({"test_acceptance":true,"noProductionEvidence":true,"native_recovery":true,"recovery_record_sha256":hash(b"recovery record"),"partial_proof_sha256":hash(b"partial"),"test_result_id":m.test_result_id,"effect_armed_ledger_id":"ledger","packages":[{"name":"rmm-mvp-test","architecture":"all","version":"1.0"}],"snapshot_sha256":hash(b"snapshot"),"fixture_payload_sha256":hash(b"1.0\n"),"reboot_required":false});
|
||||
let encode_result = |e: &serde_json::Value| {
|
||||
serde_json::to_vec(&serde_json::json!({"effect_state":"verified","code":"POSTCONDITIONS_VERIFIED","evidence":e})).unwrap()
|
||||
};
|
||||
assert_eq!(
|
||||
map_driver_result(&encode_result(&evidence), Some(0), true, &m, "ledger")
|
||||
.unwrap()
|
||||
.state,
|
||||
"succeeded"
|
||||
);
|
||||
evidence["native_record_sha256"] = serde_json::json!(hash(b"fake install acceptance"));
|
||||
assert!(map_driver_result(&encode_result(&evidence), Some(0), true, &m, "ledger").is_err());
|
||||
evidence
|
||||
.as_object_mut()
|
||||
.unwrap()
|
||||
.remove("native_record_sha256");
|
||||
evidence["partial_proof_sha256"] = serde_json::json!(hash(b"other"));
|
||||
assert!(map_driver_result(&encode_result(&evidence), Some(0), true, &m, "ledger").is_err());
|
||||
m.schema_version = 2;
|
||||
assert!(validate_manifest(&m, "apt_native_acceptance", &config).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn actual_domain_native_action_roundtrips_exact_signed_manifest_to_helper() {
|
||||
let (binding, mut request, key, now) = signed_request();
|
||||
@@ -352,6 +392,7 @@ fn consumed_parent_row_and_original_start_request_are_mandatory() {
|
||||
fn manifest(bootstrap: bool) -> (ProviderConfig, AptExecutionManifest) {
|
||||
let transaction = ResolvedAptTransaction {
|
||||
schema_version: 1,
|
||||
operation: None,
|
||||
recipe_id: INSTALL_RECIPE.into(),
|
||||
recipe_version: "1".into(),
|
||||
platform: "ubuntu-24.04-amd64".into(),
|
||||
@@ -398,6 +439,7 @@ fn manifest(bootstrap: bool) -> (ProviderConfig, AptExecutionManifest) {
|
||||
runtime_sha256: config.runtime_sha256.clone(),
|
||||
test_result_id: "fixture-test-1".into(),
|
||||
native_retry: None,
|
||||
native_recovery: None,
|
||||
};
|
||||
(config, manifest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user