Skip to content

Commit

Permalink
Fix failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestoLoma committed Nov 25, 2024
1 parent 2e4b7fc commit 8f44bb9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/integration/custom_metadata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
from tests.integration.admin_test import create_group, delete_group
from tests.integration.client import TestId, delete_asset
from tests.integration.glossary_test import create_glossary, create_term
from tests.integration.utils import wait_for_successful_custometadatadef_purge
from tests.integration.utils import (
wait_for_successful_custometadatadef_purge,
wait_for_successful_enumadef_purge,
)

MODULE_NAME = TestId.make_unique("CM")

Expand Down Expand Up @@ -310,7 +313,7 @@ def cm_enum(
) -> Generator[EnumDef, None, None]:
enum_def = create_enum(client, name=DQ_ENUM, values=DQ_TYPE_LIST)
yield enum_def
wait_for_successful_custometadatadef_purge(DQ_ENUM, client=client)
wait_for_successful_enumadef_purge(DQ_ENUM, client=client)


def test_cm_enum(
Expand Down
11 changes: 10 additions & 1 deletion tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pyatlan.model.assets import Asset
from pyatlan.model.enums import EntityStatus
from pyatlan.model.response import AssetMutationResponse
from pyatlan.model.typedef import AtlanTagDef, CustomMetadataDef
from pyatlan.model.typedef import AtlanTagDef, CustomMetadataDef, EnumDef


def block(
Expand Down Expand Up @@ -65,3 +65,12 @@ def wait_for_successful_tagdef_purge(name: str, client: AtlanClient):
)
def wait_for_successful_custometadatadef_purge(name: str, client: AtlanClient):
client.typedef.purge(name, typedef_type=CustomMetadataDef)


@retry(
retry=retry_if_exception_type(AtlanError),
wait=wait_random_exponential(multiplier=1, max=5),
stop=stop_after_attempt(3),
)
def wait_for_successful_enumadef_purge(name: str, client: AtlanClient):
client.typedef.purge(name, typedef_type=EnumDef)

0 comments on commit 8f44bb9

Please sign in to comment.