From adc7d977dd688133f52606737fd2b13edfb9a176 Mon Sep 17 00:00:00 2001 From: Simon Heisterkamp Date: Fri, 30 Sep 2022 12:39:25 +0000 Subject: [PATCH] fix imports --- tests/cluster/delta/test_delta_class.py | 3 +-- tests/cluster/eh/test_eh_saving.py | 9 +++++++-- tests/cluster/etl/test_deltaupsert.py | 7 +++---- tests/cluster/etl/test_upsertloader.py | 7 +++---- tests/cluster/mount/__init__.py | 3 +-- tests/cluster/mount/mounts.json | 10 ---------- 6 files changed, 15 insertions(+), 24 deletions(-) delete mode 100644 tests/cluster/mount/mounts.json diff --git a/tests/cluster/delta/test_delta_class.py b/tests/cluster/delta/test_delta_class.py index c4673a0c..b60c8d85 100644 --- a/tests/cluster/delta/test_delta_class.py +++ b/tests/cluster/delta/test_delta_class.py @@ -8,8 +8,7 @@ from atc.etl.extractors import SimpleExtractor from atc.etl.loaders import SimpleLoader from atc.spark import Spark - -from ..mount import prepare_environment +from tests.cluster.mount import prepare_environment class DeltaTests(unittest.TestCase): diff --git a/tests/cluster/eh/test_eh_saving.py b/tests/cluster/eh/test_eh_saving.py index 800d89b6..12a3517f 100644 --- a/tests/cluster/eh/test_eh_saving.py +++ b/tests/cluster/eh/test_eh_saving.py @@ -8,8 +8,8 @@ from atc.eh import EventHubCapture from atc.functions import init_dbutils from atc.spark import Spark +from tests.cluster.mount import prepare_environment -from ..mount import prepare_environment, storageAccount from .AtcEh import AtcEh @@ -38,7 +38,12 @@ def test_02_wait_for_capture_files(self): limit = datetime.now() + timedelta(minutes=10) while datetime.now() < limit: - conts = {item.name for item in dbutils.fs.ls(storageAccount)} + conts = { + item.name + for item in dbutils.fs.ls( + TableConfigurator().table_name("storageAccount") + ) + } if "githubatc/" in conts: break else: diff --git a/tests/cluster/etl/test_deltaupsert.py b/tests/cluster/etl/test_deltaupsert.py index 47461712..cc7e3087 100644 --- a/tests/cluster/etl/test_deltaupsert.py +++ b/tests/cluster/etl/test_deltaupsert.py @@ -5,10 +5,9 @@ from atc.config_master import TableConfigurator from atc.delta import DbHandle, DeltaHandle from atc.utils import DataframeCreator - -from ..delta import extras -from ..delta.SparkExecutor import SparkSqlExecutor -from ..mount import prepare_environment +from tests.cluster.delta import extras +from tests.cluster.delta.SparkExecutor import SparkSqlExecutor +from tests.cluster.mount import prepare_environment class DeltaUpsertTests(DataframeTestCase): diff --git a/tests/cluster/etl/test_upsertloader.py b/tests/cluster/etl/test_upsertloader.py index 69718c69..ce120bb5 100644 --- a/tests/cluster/etl/test_upsertloader.py +++ b/tests/cluster/etl/test_upsertloader.py @@ -7,10 +7,9 @@ from atc.etl.loaders.UpsertLoader import UpsertLoader from atc.etl.loaders.UpsertLoaderParameters import UpsertLoaderParameters from atc.utils import DataframeCreator - -from ..delta import extras -from ..delta.SparkExecutor import SparkSqlExecutor -from ..mount import prepare_environment +from tests.cluster.delta import extras +from tests.cluster.delta.SparkExecutor import SparkSqlExecutor +from tests.cluster.mount import prepare_environment class UpsertLoaderTests(DataframeTestCase): diff --git a/tests/cluster/mount/__init__.py b/tests/cluster/mount/__init__.py index 7b76c077..0eb13045 100644 --- a/tests/cluster/mount/__init__.py +++ b/tests/cluster/mount/__init__.py @@ -2,8 +2,6 @@ from atc.functions import init_dbutils from atc.spark import Spark -storageAccount = "githubatc.dfs.core.windows.net" - def prepare_environment(): # with the following lines, the storage account can be mounted directly @@ -15,6 +13,7 @@ def prepare_environment(): clientSecret = dbutils.secrets.get(scope=scope, key="Databricks--ClientSecret") clientId = dbutils.secrets.get(scope=scope, key="Databricks--ClientId") tenant = dbutils.secrets.get(scope=scope, key="Databricks--TenantId") + storageAccount = "githubatc.dfs.core.windows.net" prfx = "fs.azure.account" spark.conf.set(f"{prfx}.auth.type.{storageAccount}", "OAuth") diff --git a/tests/cluster/mount/mounts.json b/tests/cluster/mount/mounts.json deleted file mode 100644 index f41155a0..00000000 --- a/tests/cluster/mount/mounts.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "storageAccountName":"githubatc", - "secretScope":"secrets", - "clientIdName":"Databricks--ClientId", - "clientSecretName":"Databricks--ClientSecret", - "tenantIdName":"Databricks--TenantId", - "containers":["silver"] - } -]