| 472 | |
| 473 | #[test] |
| 474 | fn test_is_valid_procedure() { |
| 475 | log::debug!("🔍 Testing system procedure validation"); |
| 476 | |
| 477 | // Use isolated fixture for consistency (this test doesn't need fraud data) |
| 478 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 479 | |
| 480 | // Test all valid procedures - they should all execute without "not found" errors |
| 481 | let valid_procedures = vec![ |
| 482 | "gql.list_schemas", |
| 483 | "gql.list_graphs", |
| 484 | "gql.list_graph_types", |
| 485 | "gql.list_functions", |
| 486 | "gql.list_roles", |
| 487 | "gql.list_users", |
| 488 | "gql.show_session", |
| 489 | "gql.cache_stats", |
| 490 | "gql.clear_cache", |
| 491 | ]; |
| 492 | |
| 493 | log::debug!(" ✅ Testing {} valid procedures", valid_procedures.len()); |
| 494 | |
| 495 | for proc_name in &valid_procedures { |
| 496 | log::debug!(" Testing: {}", proc_name); |
| 497 | |
| 498 | // Each procedure should execute without "not found" error |
| 499 | // Some may fail with other errors (like missing arguments), but they should be recognized |
| 500 | let result = fixture.query(&format!("CALL {}()", proc_name)); |
| 501 | |
| 502 | // Check that we don't get "not found" or "not supported" error |
| 503 | if let Err(err_msg) = result { |
| 504 | let err_str = err_msg.to_string(); |
| 505 | assert!( |
| 506 | !err_str.contains("not found") && !err_str.contains("not supported"), |
| 507 | "Procedure {} should be recognized as valid, but got error: {}", |
| 508 | proc_name, |
| 509 | err_str |
| 510 | ); |
| 511 | // It's OK if it fails for other reasons (like validation errors) |
| 512 | log::debug!( |
| 513 | " ✓ {} recognized (may have validation errors, which is OK)", |
| 514 | proc_name |
| 515 | ); |
| 516 | } else { |
| 517 | log::debug!(" ✓ {} executed successfully", proc_name); |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | // Test invalid procedures - should get error (may be "not found" or other execution error) |
| 522 | let invalid_procedures = vec![ |
| 523 | "gql.invalid_procedure", |
| 524 | "gql.drop_database", // Dangerous operation not exposed |
| 525 | "gql.shutdown", // System operation not exposed |
| 526 | "system.invalid", |
| 527 | ]; |
| 528 | |
| 529 | log::debug!( |
| 530 | " ❌ Testing {} invalid procedures (should fail)", |
| 531 | invalid_procedures.len() |