Skip to content

Commit

Permalink
verify health msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
petrkalos committed Oct 25, 2024
1 parent af5f69c commit 0a41428
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def check_share_succeeded(client, shareUri, check_contains_all_item_types=False)
assert_that(items).extracting('itemType').contains(*ALL_S3_SHARABLE_TYPES_NAMES)


def check_verify_share_items(client, shareUri, expected_health_status=['Healthy']):
def check_verify_share_items(client, shareUri, expected_health_status=['Healthy'], expected_health_msg=[]):
share = get_share_object(client, shareUri, {'isShared': True})
items = share['items'].nodes
times = [item.lastVerificationTime for item in items]
Expand All @@ -95,6 +95,9 @@ def check_verify_share_items(client, shareUri, expected_health_status=['Healthy'
assert_that(items).extracting('status').contains_only('Share_Succeeded')
assert_that(items).extracting('healthStatus').contains_only(*expected_health_status)
assert_that(items).extracting('lastVerificationTime').does_not_contain(*times)
if expected_health_msg:
health_msgs = ' '.join([i.healthMessage for i in items])
assert_that(health_msgs).contains(*expected_health_msg)


def check_table_access(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
)
from tests_new.integration_tests.modules.shares.utils import (
check_share_ready,
check_share_items_reapplied,
)


Expand Down Expand Up @@ -195,9 +196,18 @@ def test_unhealthy_items(
db_name = f'dataall_{share.dataset.datasetName}_{share.dataset.datasetUri}_shared'.replace('-', '_')
lf_client.revoke_db_perms(principal_role.arn, db_name, ['DESCRIBE'])
# verify all items are `Unhealthy`
check_verify_share_items(client5, share.shareUri, expected_health_status=['Unhealthy'])
check_verify_share_items(
client5,
share.shareUri,
expected_health_status=['Unhealthy'],
expected_health_msg=[
'IAM Policy attached Target Resource does not exist',
'missing LF permissions: DESCRIBE',
],
)


@pytest.mark.dependency(depends=['share_approved'])
def test_reapply_unauthoried(client5, share_params_main):
share, _ = share_params_main
share_uri = share.shareUri
Expand All @@ -208,6 +218,7 @@ def test_reapply_unauthoried(client5, share_params_main):
)


@pytest.mark.dependency(depends=['share_approved'])
def test_reapply(client1, share_params_main):
share, _ = share_params_main
share_uri = share.shareUri
Expand All @@ -216,6 +227,7 @@ def test_reapply(client1, share_params_main):
reapply_items_share_object(client1, share_uri, item_uris)
share_object = get_share_object(client1, share_uri)
assert_that(share_object['items'].nodes).extracting('healthStatus').contains_only('PendingReApply')
check_share_items_reapplied(client1, share_uri)
check_verify_share_items(client1, share_uri)


Expand Down

0 comments on commit 0a41428

Please sign in to comment.