()
| 574 | |
| 575 | #[tokio::test] |
| 576 | async fn test_async_catalog_provider_resolve() { |
| 577 | async fn check( |
| 578 | refs: Vec<TableReference>, |
| 579 | expected_lookup_count: u32, |
| 580 | found_schemas: &[&str], |
| 581 | not_found_schemas: &[&str], |
| 582 | ) { |
| 583 | let async_provider = MockAsyncCatalogProvider::default(); |
| 584 | let cached_provider = async_provider |
| 585 | .resolve(&refs, &test_config(), MOCK_CATALOG) |
| 586 | .await |
| 587 | .unwrap(); |
| 588 | |
| 589 | assert_eq!( |
| 590 | async_provider.lookup_count.load(Ordering::Acquire), |
| 591 | expected_lookup_count |
| 592 | ); |
| 593 | |
| 594 | for schema_ref in found_schemas { |
| 595 | let schema = cached_provider.schema(schema_ref); |
| 596 | assert!(schema.is_some()); |
| 597 | } |
| 598 | |
| 599 | for schema_ref in not_found_schemas { |
| 600 | assert!(cached_provider.schema(schema_ref).is_none()); |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | // Basic full lookups |
| 605 | check( |
| 606 | vec![ |
| 607 | TableReference::full(MOCK_CATALOG, MOCK_SCHEMA, "x"), |
| 608 | TableReference::full(MOCK_CATALOG, "not_exists", "x"), |
| 609 | ], |
| 610 | 2, |
| 611 | &[MOCK_SCHEMA], |
| 612 | &["not_exists"], |
| 613 | ) |
| 614 | .await; |
| 615 | |
| 616 | // Catalog mismatch doesn't even search |
| 617 | check( |
| 618 | vec![TableReference::full("foo", MOCK_SCHEMA, "x")], |
| 619 | 0, |
| 620 | &[], |
| 621 | &[MOCK_SCHEMA], |
| 622 | ) |
| 623 | .await; |
| 624 | |
| 625 | // Both hits and misses cached |
| 626 | check( |
| 627 | vec![ |
| 628 | TableReference::full(MOCK_CATALOG, MOCK_SCHEMA, "x"), |
| 629 | TableReference::full(MOCK_CATALOG, MOCK_SCHEMA, "x"), |
| 630 | TableReference::full(MOCK_CATALOG, "not_exists", "x"), |
| 631 | TableReference::full(MOCK_CATALOG, "not_exists", "x"), |
| 632 | ], |
| 633 | 2, |
nothing calls this directly
no test coverage detected
searching dependent graphs…