Skip to content

Commit

Permalink
Modify hasattr logic, add logging info to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
hehe7318 committed Jul 1, 2024
1 parent 2803a93 commit 1319c40
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/integration-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ class SharedClusterDetectionTimeoutError(Exception):
pass


class SharedClusterDetectionTimeoutError(Exception):
"""Custom exception for shared cluster detection timeout."""

pass


@pytest.fixture(scope="module")
@pytest.mark.usefixtures("setup_credentials")
def shared_clusters_factory(request):
Expand All @@ -383,11 +389,17 @@ def shared_clusters_factory(request):
"""
factory = ClustersFactory(delete_logs_on_success=request.config.getoption("delete_logs_on_success"))

if not hasattr(request.module, "shared_existing_cluster"):
request.module.shared_existing_cluster = None
if not hasattr(request.module, "is_cluster_started_to_create"):
logging.info("Setting is_cluster_started_to_create and shared_existing_cluster")
request.module.is_cluster_started_to_create = False
request.module.shared_existing_cluster = None

def _cluster_factory(cluster_config, region, upper_case_cluster_name=False, custom_cli_credentials=None, **kwargs):
logging.info(
"Shared cluster already started to create"
if request.module.is_cluster_started_to_create
else "Start to create shared cluster"
)
if request.module.is_cluster_started_to_create:
for retry in range(40):
if request.module.shared_existing_cluster:
Expand Down

0 comments on commit 1319c40

Please sign in to comment.