()
| 7 | #[tokio::test] |
| 8 | #[ignore] |
| 9 | async fn benchmark_batch_operations() { |
| 10 | // Test parameters |
| 11 | const TOTAL_ROWS: usize = 1000; |
| 12 | const OPERATIONS: usize = 500; |
| 13 | |
| 14 | // Setup test database |
| 15 | let db_path = "/tmp/pgsqlite_batch_ops_bench.db"; |
| 16 | let _ = std::fs::remove_file(db_path); |
| 17 | |
| 18 | let conn = Connection::open(db_path).unwrap(); |
| 19 | |
| 20 | // Create test table |
| 21 | conn.execute( |
| 22 | "CREATE TABLE batch_ops_test ( |
| 23 | id INTEGER PRIMARY KEY, |
| 24 | name TEXT NOT NULL, |
| 25 | value INTEGER NOT NULL, |
| 26 | status TEXT DEFAULT 'active' |
| 27 | )", |
| 28 | [], |
| 29 | ).unwrap(); |
| 30 | |
| 31 | // Insert test data |
| 32 | for i in 0..TOTAL_ROWS { |
| 33 | conn.execute( |
| 34 | "INSERT INTO batch_ops_test (id, name, value) VALUES (?1, ?2, ?3)", |
| 35 | rusqlite::params![i as i32, format!("item_{}", i), i as i32 * 10], |
| 36 | ).unwrap(); |
| 37 | } |
| 38 | |
| 39 | drop(conn); // Close connection before starting server |
| 40 | |
| 41 | // Run migration |
| 42 | let output = tokio::process::Command::new("cargo") |
| 43 | .args(["run", "--release", "--bin", "pgsqlite", "--", "-d", db_path, "--migrate"]) |
| 44 | .output() |
| 45 | .await |
| 46 | .expect("Failed to run migration"); |
| 47 | |
| 48 | if !output.status.success() { |
| 49 | panic!("Migration failed: {}", String::from_utf8_lossy(&output.stderr)); |
| 50 | } |
| 51 | |
| 52 | // Insert schema info |
| 53 | let conn = Connection::open(db_path).unwrap(); |
| 54 | conn.execute("INSERT OR IGNORE INTO __pgsqlite_schema (table_name, column_name, pg_type) VALUES ('batch_ops_test', 'id', 'int4')", []).unwrap(); |
| 55 | conn.execute("INSERT OR IGNORE INTO __pgsqlite_schema (table_name, column_name, pg_type) VALUES ('batch_ops_test', 'name', 'text')", []).unwrap(); |
| 56 | conn.execute("INSERT OR IGNORE INTO __pgsqlite_schema (table_name, column_name, pg_type) VALUES ('batch_ops_test', 'value', 'int4')", []).unwrap(); |
| 57 | conn.execute("INSERT OR IGNORE INTO __pgsqlite_schema (table_name, column_name, pg_type) VALUES ('batch_ops_test', 'status', 'text')", []).unwrap(); |
| 58 | drop(conn); |
| 59 | |
| 60 | // Start pgsqlite server |
| 61 | let port = 25438; |
| 62 | let _ = tokio::process::Command::new("pkill") |
| 63 | .args(["-f", &format!("pgsqlite.*{port}")]) |
| 64 | .output() |
| 65 | .await; |
| 66 |
nothing calls this directly
no test coverage detected