0.3.16-pre.007
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/unit_tests/persistence.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum FakeResponse {
|
||||
@@ -143,6 +143,14 @@ fn store_outcome(
|
||||
return ksp_store_lib::RawAcquisitionWriteOutcome::new(entity, observation);
|
||||
}
|
||||
|
||||
fn store_variant_outcome(
|
||||
entity: ksp_store_lib::RawEntityWriteOutcome,
|
||||
observation: ksp_store_lib::RawObservationWriteOutcome,
|
||||
transaction_variant: ksp_store_lib::RawTransactionVariantWriteOutcome,
|
||||
) -> ksp_store_lib::RawAcquisitionWriteOutcome {
|
||||
return ksp_store_lib::RawAcquisitionWriteOutcome::with_transaction_variant(entity, observation, transaction_variant);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pre_007_missing_skips_store_and_preserves_network_scoped_identity() {
|
||||
let reference = match raw_reference("devnet", 1) {
|
||||
@@ -266,7 +274,33 @@ async fn pre_007_normal_backfill_respects_purged_tombstone_without_observation()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pre_007_store_content_conflict_is_explicit_and_not_idempotent_success() {
|
||||
async fn v0_3_16_pre_007_durable_quarantined_conflict_preserves_observation_projection() {
|
||||
let (reference, transaction, observation) = match raw_acquisition_parts("devnet", 6, 16) {
|
||||
std::option::Option::Some(parts) => parts,
|
||||
std::option::Option::None => return,
|
||||
};
|
||||
let network = match raw_network("devnet") {
|
||||
std::option::Option::Some(network) => network,
|
||||
std::option::Option::None => return,
|
||||
};
|
||||
let response = store_variant_outcome(
|
||||
ksp_store_lib::RawEntityWriteOutcome::AlreadyPresent,
|
||||
ksp_store_lib::RawObservationWriteOutcome::Inserted,
|
||||
ksp_store_lib::RawTransactionVariantWriteOutcome::QuarantinedConflict,
|
||||
);
|
||||
let port = FakePersistencePort::new(network, &[FakeResponse::Outcome(response)]);
|
||||
let result = super::persist_available_with_port(&port, reference, transaction, observation).await;
|
||||
assert!(result.is_ok());
|
||||
if let std::result::Result::Ok(result) = result {
|
||||
assert_eq!(result.entity(), crate::BackfillEntityPersistence::Conflict);
|
||||
assert_eq!(result.observation(), crate::BackfillObservationPersistence::Inserted);
|
||||
assert_ne!(result.entity(), crate::BackfillEntityPersistence::AlreadyPresent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pre_007_legacy_store_content_conflict_error_is_explicit_and_not_idempotent_success() {
|
||||
let (reference, transaction, observation) = match raw_acquisition_parts("devnet", 6, 16) {
|
||||
std::option::Option::Some(parts) => parts,
|
||||
std::option::Option::None => return,
|
||||
|
||||
Reference in New Issue
Block a user