MCPcopy Create free account
hub / github.com/apache/paimon-rust / setup_test_server

Function setup_test_server

crates/paimon/tests/rest_api_test.rs:42–71  ·  view source on GitHub ↗

Helper function to set up a test environment with a custom prefix.

(initial_dbs: Vec<&str>)

Source from the content-addressed store, hash-verified

40
41/// Helper function to set up a test environment with a custom prefix.
42async fn setup_test_server(initial_dbs: Vec<&str>) -> TestContext {
43 let prefix = "mock-test";
44 // Create config with prefix
45 let mut defaults = HashMap::new();
46 defaults.insert("prefix".to_string(), prefix.to_string());
47 let config = ConfigResponse::new(defaults);
48
49 let initial: Vec<String> = initial_dbs.iter().map(|s| s.to_string()).collect();
50 // Start server with config
51 let server = start_mock_server(
52 "test_warehouse".to_string(), // warehouse
53 "/tmp/test_warehouse".to_string(), // data_path
54 config,
55 initial,
56 )
57 .await;
58 let token = "test_token";
59 let url = server.url().expect("Failed to get server URL");
60 let mut options = Options::new();
61 options.set("uri", &url);
62 options.set("warehouse", "test_warehouse");
63 options.set("token.provider", "bear");
64 options.set("token", token);
65
66 let api = RESTApi::new(options, true)
67 .await
68 .expect("Failed to create RESTApi");
69
70 TestContext { server, api, url }
71}
72
73// ==================== Database Tests ====================
74#[tokio::test]

Calls 5

start_mock_serverFunction · 0.85
insertMethod · 0.80
urlMethod · 0.80
setMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected