()
| 506 | |
| 507 | #[test] |
| 508 | fn test_performance_queries() { |
| 509 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 510 | // Setup fresh graph for this test to avoid interference |
| 511 | fixture |
| 512 | .setup_graph("test_performance_queries") |
| 513 | .expect("Failed to setup graph"); |
| 514 | // Re-insert fraud data since we have a fresh graph |
| 515 | fixture |
| 516 | .insert_fraud_data() |
| 517 | .expect("Failed to insert fraud data"); |
| 518 | |
| 519 | // Test query performance on large dataset |
| 520 | let start = std::time::Instant::now(); |
| 521 | |
| 522 | let result = fixture.assert_query_succeeds( |
| 523 | "MATCH (a:Account)-[t:Transaction]->(m:Merchant) |
| 524 | RETURN m.category, |
| 525 | count(t) as transaction_count, |
| 526 | sum(t.amount) as total_amount, |
| 527 | avg(t.amount) as avg_amount, |
| 528 | min(t.amount) as min_amount, |
| 529 | max(t.amount) as max_amount |
| 530 | GROUP BY m.category |
| 531 | ORDER BY total_amount DESC", |
| 532 | ); |
| 533 | |
| 534 | let duration = start.elapsed(); |
| 535 | assert!( |
| 536 | duration.as_secs() < 10, |
| 537 | "Complex query should complete within 10 seconds" |
| 538 | ); |
| 539 | assert!(!result.rows.is_empty()); |
| 540 | |
| 541 | // Test index-friendly queries |
| 542 | let start = std::time::Instant::now(); |
| 543 | |
| 544 | fixture.assert_query_succeeds( |
| 545 | "MATCH (a:Account) |
| 546 | WHERE a.id = '4000000001' |
| 547 | RETURN a.*", |
| 548 | ); |
| 549 | |
| 550 | let duration = start.elapsed(); |
| 551 | assert!( |
| 552 | duration.as_millis() < 100, |
| 553 | "Index lookup should be very fast" |
| 554 | ); |
| 555 | |
| 556 | // Test large result set handling |
| 557 | let start = std::time::Instant::now(); |
| 558 | |
| 559 | let _result = fixture.assert_query_succeeds( |
| 560 | "MATCH (a:Account)-[t:Transaction]->(m:Merchant) |
| 561 | RETURN a.id, m.name, t.amount, t.timestamp |
| 562 | ORDER BY t.amount DESC", |
| 563 | ); |
| 564 | |
| 565 | let duration = start.elapsed(); |
nothing calls this directly
no test coverage detected