(state_builder: TestCatalogStateBuilder)
| 457 | } |
| 458 | |
| 459 | async fn test_debug_delete_fencing(state_builder: TestCatalogStateBuilder) { |
| 460 | let mut state = state_builder |
| 461 | .clone() |
| 462 | .with_default_deploy_generation() |
| 463 | .unwrap_build() |
| 464 | .await |
| 465 | .open(SYSTEM_TIME().into(), &test_bootstrap_args()) |
| 466 | .await |
| 467 | .unwrap() |
| 468 | .0; |
| 469 | // Drain state updates. |
| 470 | let _ = state.sync_to_current_updates().await; |
| 471 | |
| 472 | let mut txn = state.transaction().await.unwrap(); |
| 473 | txn.set_config("joe".to_string(), Some(666)).unwrap(); |
| 474 | let commit_ts = txn.upper(); |
| 475 | txn.commit(commit_ts).await.unwrap(); |
| 476 | |
| 477 | let mut debug_state = state_builder |
| 478 | .clone() |
| 479 | .unwrap_build() |
| 480 | .await |
| 481 | .open_debug() |
| 482 | .await |
| 483 | .unwrap(); |
| 484 | |
| 485 | // State isn't fenced yet. |
| 486 | assert_ok!(state.snapshot().await); |
| 487 | assert_ok!(state.transaction().await); |
| 488 | |
| 489 | // Delete from catalog via debug_state. |
| 490 | debug_state |
| 491 | .delete::<SettingCollection>(proto::SettingKey { |
| 492 | name: "joe".to_string(), |
| 493 | }) |
| 494 | .await |
| 495 | .unwrap(); |
| 496 | |
| 497 | // Now state should be fenced. |
| 498 | let err = state.snapshot().await.unwrap_err(); |
| 499 | assert!( |
| 500 | matches!( |
| 501 | err, |
| 502 | CatalogError::Durable(DurableCatalogError::Fence(FenceError::Epoch { .. })) |
| 503 | ), |
| 504 | "unexpected err: {err:?}" |
| 505 | ); |
| 506 | |
| 507 | let err = state.transaction().await.unwrap_err(); |
| 508 | assert!( |
| 509 | matches!( |
| 510 | err, |
| 511 | CatalogError::Durable(DurableCatalogError::Fence(FenceError::Epoch { .. })) |
| 512 | ), |
| 513 | "unexpected err: {err:?}" |
| 514 | ); |
| 515 | |
| 516 | // Open another state to fence the debug state. |
no test coverage detected