Skip to content

Commit

Permalink
make sure os is cleared when running pat int tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiseck3 committed Jan 9, 2025
1 parent 757b329 commit 9b33680
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions test/integration/connectors/databricks/test_volumes_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,40 +148,42 @@ async def test_volumes_native_source_pat(tmp_path: Path):
@requires_env("DATABRICKS_HOST", "DATABRICKS_PAT", "DATABRICKS_CATALOG")
def test_volumes_native_source_pat_invalid_catalog():
env_data = get_pat_env_data()
indexer_config = DatabricksNativeVolumesIndexerConfig(
recursive=True,
volume="test-platform",
volume_path="databricks-volumes-test-input",
catalog="fake_catalog",
)
indexer = DatabricksNativeVolumesIndexer(
connection_config=env_data.get_connection_config(), index_config=indexer_config
)
with pytest.raises(UserError):
_ = list(indexer.run())
with mock.patch.dict(os.environ, clear=True):
indexer_config = DatabricksNativeVolumesIndexerConfig(
recursive=True,
volume="test-platform",
volume_path="databricks-volumes-test-input",
catalog="fake_catalog",
)
indexer = DatabricksNativeVolumesIndexer(
connection_config=env_data.get_connection_config(), index_config=indexer_config
)
with pytest.raises(UserError):
_ = list(indexer.run())


@pytest.mark.tags(CONNECTOR_TYPE, SOURCE_TAG)
@requires_env("DATABRICKS_HOST")
def test_volumes_native_source_pat_invalid_pat():
host = os.environ["DATABRICKS_HOST"]
indexer_config = DatabricksNativeVolumesIndexerConfig(
recursive=True,
volume="test-platform",
volume_path="databricks-volumes-test-input",
catalog="fake_catalog",
)
connection_config = DatabricksNativeVolumesConnectionConfig(
host=host,
access_config=DatabricksNativeVolumesAccessConfig(
token="invalid-token",
),
)
indexer = DatabricksNativeVolumesIndexer(
connection_config=connection_config, index_config=indexer_config
)
with pytest.raises(UserAuthError):
_ = list(indexer.run())
with mock.patch.dict(os.environ, clear=True):
indexer_config = DatabricksNativeVolumesIndexerConfig(
recursive=True,
volume="test-platform",
volume_path="databricks-volumes-test-input",
catalog="fake_catalog",
)
connection_config = DatabricksNativeVolumesConnectionConfig(
host=host,
access_config=DatabricksNativeVolumesAccessConfig(
token="invalid-token",
),
)
indexer = DatabricksNativeVolumesIndexer(
connection_config=connection_config, index_config=indexer_config
)
with pytest.raises(UserAuthError):
_ = list(indexer.run())


def _get_volume_path(catalog: str, volume: str, volume_path: str):
Expand Down

0 comments on commit 9b33680

Please sign in to comment.