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

Function test_serialized_ddl_serial

src/environmentd/tests/sql.rs:3956–3989  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3954#[cfg_attr(miri, ignore)] // too slow
3955#[allow(clippy::disallowed_methods)]
3956async fn test_serialized_ddl_serial() {
3957 let server = test_util::TestHarness::default().start().await;
3958 let mut handles = Vec::new();
3959 let n = 10;
3960 for i in 0..n {
3961 let client = server.connect().await.unwrap();
3962 let handle = task::spawn(|| "test", async move {
3963 let stmt = format!("CREATE VIEW v AS SELECT {i}");
3964 let res = client
3965 .batch_execute(&stmt)
3966 .await
3967 .map_err(|err| err.to_string());
3968 res
3969 });
3970 handles.push(handle);
3971 }
3972
3973 let mut successes = 0;
3974 let mut errors = 0;
3975 for handle in handles {
3976 let result = handle.await;
3977 match result {
3978 Ok(_) => {
3979 successes += 1;
3980 }
3981 Err(_) => {
3982 errors += 1;
3983 }
3984 }
3985 }
3986 // Exactly one must succeed.
3987 assert_eq!(successes, 1);
3988 assert_eq!(errors, n - 1);
3989}
3990
3991// Test that serial DDLs are cancellable.
3992#[mz_ore::test(tokio::test(flavor = "multi_thread", worker_threads = 1))]

Callers

nothing calls this directly

Calls 7

spawnFunction · 0.85
unwrapMethod · 0.80
batch_executeMethod · 0.80
startMethod · 0.45
connectMethod · 0.45
to_stringMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected