|
9 | 9 | ConnectionId, |
10 | 10 | DatabaseConnectionConfig, |
11 | 11 | DatabaseType, |
| 12 | + DatabricksDeltaS3ConnectionConfig, |
12 | 13 | DynamoConnectionConfig, |
13 | 14 | MongoConnectionConfig, |
14 | 15 | MountedShareConnectionConfig, |
@@ -695,6 +696,65 @@ def test_s3_connection_model_validate_no_iam_role(): |
695 | 696 | assert conn.iam_role_arn is None |
696 | 697 |
|
697 | 698 |
|
| 699 | +def test_databricks_delta_s3_connection_model_validate(): |
| 700 | + payload = { |
| 701 | + "id": "11223344-5566-7788-99aa-bbccddeeff00", |
| 702 | + "name": "delta_s3", |
| 703 | + "mask_type": "file", |
| 704 | + "type": "databricks_delta_s3_connection", |
| 705 | + "base_directory": "delta/", |
| 706 | + "is_file_mask_source": True, |
| 707 | + "is_file_mask_destination": False, |
| 708 | + "bucket": "my-delta-bucket", |
| 709 | + "iam_role_arn": "arn:aws:iam::111122223333:role/delta-role", |
| 710 | + } |
| 711 | + |
| 712 | + conn = DatabricksDeltaS3ConnectionConfig.model_validate(payload) |
| 713 | + |
| 714 | + assert isinstance(conn, DatabricksDeltaS3ConnectionConfig) |
| 715 | + assert conn.id == "11223344-5566-7788-99aa-bbccddeeff00" |
| 716 | + assert conn.name == "delta_s3" |
| 717 | + assert conn.bucket == "my-delta-bucket" |
| 718 | + assert conn.base_directory == "delta/" |
| 719 | + assert conn.is_file_mask_source is True |
| 720 | + assert conn.is_file_mask_destination is False |
| 721 | + assert conn.iam_role_arn == "arn:aws:iam::111122223333:role/delta-role" |
| 722 | + |
| 723 | + |
| 724 | +def test_databricks_delta_s3_connection_model_validate_no_iam_role(): |
| 725 | + payload = { |
| 726 | + "id": "id-delta", |
| 727 | + "name": "delta_s3", |
| 728 | + "mask_type": "file", |
| 729 | + "type": "databricks_delta_s3_connection", |
| 730 | + "base_directory": "", |
| 731 | + "is_file_mask_source": True, |
| 732 | + "is_file_mask_destination": False, |
| 733 | + "bucket": "my-delta-bucket", |
| 734 | + } |
| 735 | + |
| 736 | + conn = DatabricksDeltaS3ConnectionConfig.model_validate(payload) |
| 737 | + assert conn.iam_role_arn is None |
| 738 | + |
| 739 | + |
| 740 | +def test_validate_connection_dispatches_databricks_delta_s3(): |
| 741 | + payload = { |
| 742 | + "id": "aabb-ccdd", |
| 743 | + "name": "delta", |
| 744 | + "mask_type": "file", |
| 745 | + "type": "databricks_delta_s3_connection", |
| 746 | + "base_directory": "", |
| 747 | + "is_file_mask_source": False, |
| 748 | + "is_file_mask_destination": True, |
| 749 | + "bucket": "delta-bucket", |
| 750 | + } |
| 751 | + |
| 752 | + conn = validate_connection(payload) |
| 753 | + |
| 754 | + assert isinstance(conn, DatabricksDeltaS3ConnectionConfig) |
| 755 | + assert conn.bucket == "delta-bucket" |
| 756 | + |
| 757 | + |
698 | 758 | def test_azure_connection_model_validate_blanks_encrypted_connection_string(): |
699 | 759 | payload = { |
700 | 760 | "id": "490502e5-5bf6-4abb-b67b-c6091d40ecf0", |
|
0 commit comments