Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
python-version: '3.10'

- name: Install hatch
run: pip install hatch==1.9.4
run: pip install hatch==1.15.0

- name: Fetch relevant branches
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstreams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Install toolchain
run: |
pip install hatch==1.9.4
pip install hatch==1.15.0
- name: Downstreams
uses: databrickslabs/sandbox/downstreams@acceptance/v0.4.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python-version: '3.10'

- name: Install hatch
run: pip install hatch==1.9.4
run: pip install hatch==1.15.0

- name: Run nightly tests
uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- main

env:
HATCH_VERSION: 1.9.4
HATCH_VERSION: 1.15.0

jobs:
ci:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Build wheels
run: |
pip install hatch==1.9.4
pip install hatch==1.15.0
hatch build
- name: Draft release
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ Keyword Arguments:
Usage:
```python
def test_storage_credential(env_or_skip, make_storage_credential, make_random):
random = make_random(6).lower()
random = make_random(8).lower()
credential_name = f"dummy-{random}"
make_storage_credential(
credential_name=credential_name,
Expand Down Expand Up @@ -1021,7 +1021,7 @@ def test_volume_creation(make_catalog, make_schema, make_volume, make_random):
schema = make_schema(catalog_name=catalog.name)

# Generate a random name for the volume
volume_name = f"dummy_vol_{make_random(6).lower()}"
volume_name = f"dummy_vol_{make_random(8).lower()}"

# Create the volume
volume = make_volume(
Expand Down
14 changes: 7 additions & 7 deletions src/databricks/labs/pytester/fixtures/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def create( # pylint: disable=too-many-locals,too-many-arguments,too-many-state
schema = make_schema(catalog_name=catalog_name)
catalog_name = schema.catalog_name
schema_name = schema.name
name = name or f"dummy_t{make_random(4).lower()}"
name = name or f"dummy_t{make_random(8).lower()}"
table_type: TableType | None = None
data_source_format = None
storage_location = None
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table):
def create(
*, catalog_name: str = "hive_metastore", name: str | None = None, location: str | None = None
) -> SchemaInfo:
name = name or f"dummy_s{make_random(4)}".lower()
name = name or f"dummy_s{make_random(8)}".lower()
full_name = f"{catalog_name}.{name}".lower()
schema_ddl = f"CREATE SCHEMA {full_name}"
if location:
Expand Down Expand Up @@ -307,7 +307,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table):
"""

def create(*, name: str | None = None) -> CatalogInfo:
name = name or f"dummy_c{make_random(4)}".lower()
name = name or f"dummy_c{make_random(8)}".lower()
catalog_info = ws.catalogs.create(name=name, properties={"RemoveAfter": watchdog_remove_after})
if isinstance(catalog_info, Mock):
catalog_info.name = name
Expand Down Expand Up @@ -359,7 +359,7 @@ def create(
catalog_name = schema.catalog_name
schema_name = schema.name

name = name or f"dummy_f{make_random(4)}".lower()
name = name or f"dummy_f{make_random(8)}".lower()

# Note: the Watchdog does not explicitly scan for functions; they are purged along with their parent schema.
# As such the function can't be marked (and doesn't need to be if the schema as marked) for purge protection.
Expand Down Expand Up @@ -409,7 +409,7 @@ def make_storage_credential(ws, watchdog_remove_after) -> Generator[Callable[...
Usage:
```python
def test_storage_credential(env_or_skip, make_storage_credential, make_random):
random = make_random(6).lower()
random = make_random(8).lower()
credential_name = f"dummy-{random}"
make_storage_credential(
credential_name=credential_name,
Expand Down Expand Up @@ -471,7 +471,7 @@ def test_volume_creation(make_catalog, make_schema, make_volume, make_random):
schema = make_schema(catalog_name=catalog.name)

# Generate a random name for the volume
volume_name = f"dummy_vol_{make_random(6).lower()}"
volume_name = f"dummy_vol_{make_random(8).lower()}"

# Create the volume
volume = make_volume(
Expand All @@ -498,7 +498,7 @@ def create(
schema_name = schema.name

if not name:
name = f"dummy_v{make_random(6).lower()}"
name = f"dummy_v{make_random(8).lower()}"

volume_info = ws.volumes.create(
catalog_name=catalog_name,
Expand Down
16 changes: 8 additions & 8 deletions src/databricks/labs/pytester/fixtures/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_cluster_policy(make_cluster_policy):

def create(*, name: str | None = None, **kwargs) -> CreatePolicyResponse:
if name is None:
name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}"
name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}"
if "definition" not in kwargs:
kwargs["definition"] = json.dumps(
{
Expand Down Expand Up @@ -92,7 +92,7 @@ def create(
**kwargs,
) -> Wait[ClusterDetails]:
if cluster_name is None:
cluster_name = f"dummy-{make_random(4)}"
cluster_name = f"dummy-{make_random(8)}"
if spark_version is None:
spark_version = ws.clusters.select_spark_version(latest=True)
if single_node:
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_instance_pool(make_instance_pool):

def create(*, instance_pool_name=None, node_type_id=None, **kwargs) -> CreateInstancePoolResponse:
if instance_pool_name is None:
instance_pool_name = f"dummy-{make_random(4)}"
instance_pool_name = f"dummy-{make_random(8)}"
if node_type_id is None:
node_type_id = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16)
pool = ws.instance_pools.create(
Expand Down Expand Up @@ -223,16 +223,16 @@ def create( # pylint: disable=too-many-arguments
raise ValueError(
"The `tasks` parameter is exclusive with the `path`, `content` `spark_conf` and `libraries` parameters."
)
name = name or f"dummy-j{make_random(4)}"
name = name or f"dummy-j{make_random(8)}"
tags = tags or {}
tags["RemoveAfter"] = tags.get("RemoveAfter", watchdog_remove_after)
if not tasks:
node_type_id = None
if instance_pool_id is None:
node_type_id = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16)
task = Task(
task_key=make_random(4),
description=make_random(4),
task_key=make_random(8),
description=make_random(8),
new_cluster=ClusterSpec(
num_workers=1,
node_type_id=node_type_id,
Expand Down Expand Up @@ -292,7 +292,7 @@ def test_pipeline(make_pipeline, make_pipeline_permissions, make_group):

def create(**kwargs) -> CreatePipelineResponse:
if "name" not in kwargs:
kwargs["name"] = f"sdk-{make_random(4)}-{watchdog_purge_suffix}"
kwargs["name"] = f"sdk-{make_random(8)}-{watchdog_purge_suffix}"
if "libraries" not in kwargs:
notebook_library = NotebookLibrary(path=make_notebook().as_posix())
kwargs["libraries"] = [PipelineLibrary(notebook=notebook_library)]
Expand Down Expand Up @@ -342,7 +342,7 @@ def create(
**kwargs,
) -> Wait[GetWarehouseResponse]:
if warehouse_name is None:
warehouse_name = f"dummy-{make_random(4)}"
warehouse_name = f"dummy-{make_random(8)}"
if warehouse_type is None:
warehouse_type = CreateWarehouseRequestWarehouseType.PRO
if cluster_size is None:
Expand Down
4 changes: 2 additions & 2 deletions src/databricks/labs/pytester/fixtures/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_new_user(make_user, ws):

@retried(on=[ResourceConflict], timeout=timedelta(seconds=30))
def create(**kwargs) -> User:
user_name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}@example.com".lower()
user_name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}@example.com".lower()
user = ws.users.create(user_name=user_name, **kwargs)
log_workspace_link(user.user_name, f'settings/workspace/identity-and-access/users/{user.id}')
return user
Expand Down Expand Up @@ -171,7 +171,7 @@ def create(
**kwargs,
):
kwargs["display_name"] = (
f"sdk-{make_random(4)}-{watchdog_purge_suffix}" if display_name is None else display_name
f"sdk-{make_random(8)}-{watchdog_purge_suffix}" if display_name is None else display_name
)
if members is not None:
kwargs["members"] = _scim_values(members)
Expand Down
6 changes: 3 additions & 3 deletions src/databricks/labs/pytester/fixtures/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create(
folder = make_directory(path=path)
if experiment_name is None:
# The purge suffix is needed here as well, just in case the path was supplied.
experiment_name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}"
experiment_name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}"
experiment = ws.experiments.create_experiment(name=f"{folder}/{experiment_name}", **kwargs)
log_workspace_link(f'{experiment_name} experiment', f'ml/experiments/{experiment.experiment_id}', anchor=False)
return experiment
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_models(make_group, make_model, make_registered_model_permissions):

def create(*, model_name: str | None = None, **kwargs) -> ModelDatabricks:
if model_name is None:
model_name = f"dummy-{make_random(4)}"
model_name = f"dummy-{make_random(8)}"
remove_after_tag = ModelTag(key="RemoveAfter", value=watchdog_remove_after)
if 'tags' not in kwargs:
kwargs["tags"] = [remove_after_tag]
Expand Down Expand Up @@ -143,7 +143,7 @@ def create(
model_name: str | None = None,
model_version: str | None = None,
) -> Wait[ServingEndpointDetailed]:
endpoint_name = endpoint_name or make_random(4)
endpoint_name = endpoint_name or make_random(8)
model_name = model_name or "system.ai.llama_v3_2_1b_instruct"
if not model_version and "." not in model_name: # The period in the name signals it is NOT workspace local
try:
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/pytester/fixtures/redash.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create(*, sql_query: str | None = None, **kwargs) -> LegacyQuery:
tags.append(remove_after_tag)
else:
tags = [remove_after_tag]
query_name = f"dummy_query_Q{make_random(4)}"
query_name = f"dummy_query_Q{make_random(8)}"
query = ws.queries_legacy.create(
name=query_name,
description="Test query",
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/pytester/fixtures/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_secret_scope_creation(make_secret_scope):
"""

def create(**kwargs):
name = f"dummy-{make_random(4)}"
name = f"dummy-{make_random(8)}"
ws.secrets.create_scope(name, **kwargs)
return name

Expand Down
8 changes: 4 additions & 4 deletions src/databricks/labs/pytester/fixtures/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create(
else:
raise ValueError(f"Unsupported language: {language}")
current_user = ws.current_user.me()
path = path or f"/Users/{current_user.user_name}/dummy-{make_random(4)}-{watchdog_purge_suffix}"
path = path or f"/Users/{current_user.user_name}/dummy-{make_random(8)}-{watchdog_purge_suffix}"
workspace_path = WorkspacePath(ws, path)
if '@' not in current_user.user_name:
# If current user is a service principal added with `make_run_as`, there might be no home folder
Expand Down Expand Up @@ -115,7 +115,7 @@ def create(
else:
raise ValueError(f"Unsupported language: {language}")
current_user = ws.current_user.me()
path = path or f"/Users/{current_user.user_name}/dummy-{make_random(4)}-{watchdog_purge_suffix}{suffix}"
path = path or f"/Users/{current_user.user_name}/dummy-{make_random(8)}-{watchdog_purge_suffix}{suffix}"
content = content or default_content
encoding = encoding or _DEFAULT_ENCODING
workspace_path = WorkspacePath(ws, path)
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_creates_some_folder_with_a_notebook(make_directory, make_notebook):

def create(*, path: str | Path | None = None) -> WorkspacePath:
if path is None:
path = f"~/dummy-{make_random(4)}-{watchdog_purge_suffix}"
path = f"~/dummy-{make_random(8)}-{watchdog_purge_suffix}"
workspace_path = WorkspacePath(ws, path).expanduser()
workspace_path.mkdir(exist_ok=True)
logger.info(f"Created folder: {workspace_path.as_uri()}")
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_repo(make_repo):

def create(*, url=None, provider=None, path=None, **kwargs) -> RepoInfo:
if path is None:
path = f"/Repos/{ws.current_user.me().user_name}/sdk-{make_random(4)}-{watchdog_purge_suffix}"
path = f"/Repos/{ws.current_user.me().user_name}/sdk-{make_random(8)}-{watchdog_purge_suffix}"
if url is None:
url = "https://github.com/shreyas-goenka/empty-repo.git"
if provider is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/fixtures/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_schema_fixture(make_schema):
def test_managed_schema_fixture(make_schema, make_random, env_or_skip):
schema_name = f"dummy_s{make_random(4)}".lower()
schema_location = f"{env_or_skip('TEST_MOUNT_CONTAINER')}/a/{schema_name}"
logger.info(f"Created new schema: {make_schema(location = schema_location)}")
logger.info(f"Created new schema: {make_schema(location=schema_location)}")


def test_new_managed_table_in_new_schema(make_table):
Expand Down