MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_debug_edit_fencing

Function test_debug_edit_fencing

src/catalog/tests/debug.rs:364–449  ·  view source on GitHub ↗
(state_builder: TestCatalogStateBuilder)

Source from the content-addressed store, hash-verified

362}
363
364async fn test_debug_edit_fencing(state_builder: TestCatalogStateBuilder) {
365 let mut state = state_builder
366 .clone()
367 .with_default_deploy_generation()
368 .unwrap_build()
369 .await
370 .open(SYSTEM_TIME().into(), &test_bootstrap_args())
371 .await
372 .unwrap()
373 .0;
374
375 let mut debug_state = state_builder
376 .clone()
377 .unwrap_build()
378 .await
379 .open_debug()
380 .await
381 .unwrap();
382
383 // State isn't fenced yet.
384 assert_ok!(state.snapshot().await);
385 assert_ok!(state.transaction().await);
386
387 // Edit catalog via debug_state.
388 debug_state
389 .edit::<SettingCollection>(
390 proto::SettingKey {
391 name: "joe".to_string(),
392 },
393 proto::SettingValue {
394 value: "koshakow".to_string(),
395 },
396 )
397 .await
398 .unwrap();
399
400 // Now state should be fenced.
401 let err = state.snapshot().await.unwrap_err();
402 assert!(
403 matches!(
404 err,
405 CatalogError::Durable(DurableCatalogError::Fence(FenceError::Epoch { .. }))
406 ),
407 "unexpected err: {err:?}"
408 );
409
410 let err = state.transaction().await.unwrap_err();
411 assert!(
412 matches!(
413 err,
414 CatalogError::Durable(DurableCatalogError::Fence(FenceError::Epoch { .. }))
415 ),
416 "unexpected err: {err:?}"
417 );
418
419 // Open another state to fence the debug state.
420 let _state = state_builder
421 .clone()

Callers 1

Calls 10

test_bootstrap_argsFunction · 0.85
unwrapMethod · 0.80
unwrap_buildMethod · 0.80
open_debugMethod · 0.80
openMethod · 0.45
cloneMethod · 0.45
to_stringMethod · 0.45
snapshotMethod · 0.45
transactionMethod · 0.45

Tested by

no test coverage detected