MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / create_and_drop_function

Function create_and_drop_function

nodedb/tests/function_security_e2e.rs:12–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10/// CREATE FUNCTION succeeds and DROP FUNCTION removes it.
11#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
12async fn create_and_drop_function() {
13 let server = TestServer::start().await;
14
15 // Create a simple expression UDF.
16 let result = server
17 .exec("CREATE FUNCTION double_it(x INT) RETURNS INT AS SELECT x * 2")
18 .await;
19 assert!(result.is_ok(), "CREATE FUNCTION failed: {:?}", result);
20
21 // DROP FUNCTION succeeds (proves it was stored in catalog).
22 let drop_result = server.exec("DROP FUNCTION double_it").await;
23 assert!(
24 drop_result.is_ok(),
25 "DROP FUNCTION failed: {:?}",
26 drop_result
27 );
28
29 // DROP again should fail (already dropped).
30 server
31 .expect_error("DROP FUNCTION double_it", "does not exist")
32 .await;
33}
34
35/// CREATE OR REPLACE FUNCTION works.
36#[tokio::test(flavor = "multi_thread", worker_threads = 4)]

Callers

nothing calls this directly

Calls 2

expect_errorMethod · 0.80
execMethod · 0.45

Tested by

no test coverage detected