|
12 | 12 | from databricks.labs.lakebridge.reconcile.recon_capture import ( |
13 | 13 | ReconCapture, |
14 | 14 | generate_final_reconcile_output, |
| 15 | + ReconIntermediatePersist, |
15 | 16 | ) |
16 | 17 | from databricks.labs.lakebridge.reconcile.recon_output_config import ( |
17 | 18 | DataReconcileOutput, |
@@ -990,3 +991,55 @@ def test_apply_threshold_for_only_threshold_mismatch_with_true_absolute( |
990 | 991 | remorph_recon_metrics_df = spark.sql(f"select * from {recon_metadata.schema}.metrics") |
991 | 992 | row = remorph_recon_metrics_df.collect()[0] |
992 | 993 | assert row.run_metrics.status is True |
| 994 | + |
| 995 | + |
| 996 | +class ReconIntermediatePersistUnderTest(ReconIntermediatePersist): |
| 997 | + @property |
| 998 | + def is_databricks(self) -> bool: |
| 999 | + return self._is_databricks |
| 1000 | + |
| 1001 | + @property |
| 1002 | + def format(self): |
| 1003 | + return self._format |
| 1004 | + |
| 1005 | + |
| 1006 | +def test_is_databricks_false(mock_spark): |
| 1007 | + conf = ReconcileMetadataConfig() |
| 1008 | + persist = ReconIntermediatePersistUnderTest(mock_spark, conf) |
| 1009 | + |
| 1010 | + assert persist.is_databricks is False |
| 1011 | + |
| 1012 | + |
| 1013 | +def test_is_databricks_true(spark): |
| 1014 | + conf = ReconcileMetadataConfig() |
| 1015 | + persist = ReconIntermediatePersistUnderTest(spark, conf) |
| 1016 | + |
| 1017 | + assert persist.is_databricks is True |
| 1018 | + |
| 1019 | + |
| 1020 | +def test_dir_uses_tempfile(mock_spark): |
| 1021 | + conf = ReconcileMetadataConfig() |
| 1022 | + persist = ReconIntermediatePersistUnderTest(mock_spark, conf) |
| 1023 | + |
| 1024 | + assert str(persist.base_dir).startswith("/tmp/") |
| 1025 | + |
| 1026 | + |
| 1027 | +def test_format_uses_uc(spark): |
| 1028 | + conf = ReconcileMetadataConfig() |
| 1029 | + persist = ReconIntermediatePersistUnderTest(spark, conf) |
| 1030 | + |
| 1031 | + assert str(persist.base_dir).startswith("/Volumes/") |
| 1032 | + |
| 1033 | + |
| 1034 | +def test_format_uses_parquet(mock_spark): |
| 1035 | + conf = ReconcileMetadataConfig() |
| 1036 | + persist = ReconIntermediatePersistUnderTest(mock_spark, conf) |
| 1037 | + |
| 1038 | + assert persist.format == "parquet" |
| 1039 | + |
| 1040 | + |
| 1041 | +def test_format_uses_delta(spark): |
| 1042 | + conf = ReconcileMetadataConfig() |
| 1043 | + persist = ReconIntermediatePersistUnderTest(spark, conf) |
| 1044 | + |
| 1045 | + assert persist.format == "delta" |
0 commit comments