Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test unhealthy shares #1649

Merged
merged 3 commits into from
Oct 30, 2024
Merged

test unhealthy shares #1649

merged 3 commits into from
Oct 30, 2024

Conversation

petrkalos
Copy link
Contributor

@petrkalos petrkalos commented Oct 17, 2024

Feature or Bugfix

  • Feature

Detail

New tests

  • deliberately break shares (by removing permissions
  • run the verifier to assert that are unhealthy
  • run the reapplier to assert that they can be fixed

Imrpovements

  • Drop updated_persistent env and always update the persitent_env on get_or_create_env()
  • Use contextmanagers to create environments and handle their lifecycle in one place
  • Make redshift tests optional based on configuration

Relates

Solves parts of #1376

Security

Please answer the questions below briefly where applicable, or write N/A. Based on
OWASP 10.

  • Does this PR introduce or modify any input fields or queries - this includes
    fetching data from storage outside the application (e.g. a database, an S3 bucket)?
    • Is the input sanitized?
    • What precautions are you taking before deserializing the data you consume?
    • Is injection prevented by parametrizing queries?
    • Have you ensured no eval or similar functions are used?
  • Does this PR introduce any functionality or component that requires authorization?
    • How have you ensured it respects the existing AuthN/AuthZ mechanisms?
    • Are you logging failed auth attempts?
  • Are you using or adding any cryptographic features?
    • Do you use a standard proven implementations?
    • Are the used keys controlled by the customer? Where are they stored?
  • Are you introducing any new policies/roles/users?
    • Have you used the least-privilege principle? How?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@petrkalos petrkalos force-pushed the feature/share_tests branch from d1f3c09 to 13c615f Compare October 17, 2024 14:56
@petrkalos petrkalos marked this pull request as ready for review October 21, 2024 07:58
@petrkalos petrkalos force-pushed the feature/share_tests branch from d3da001 to 85969b3 Compare October 21, 2024 12:02
@@ -285,16 +285,16 @@ def persistent_group_share_1(
def persistent_role_share_1(
client5,
client1,
updated_persistent_env1,
updated_persistent_cross_acc_env_1,
persistent_env1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

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'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the check of the reasons, why share is Unhealthy? I mean, check, that the status message corresponds the things that is broken?

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_verified(client1, share_uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After share is reapplied, we need to check, that now it's healthy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I meant to do check_verify_share_items

@petrkalos petrkalos force-pushed the feature/share_tests branch from 85969b3 to 0a41428 Compare October 25, 2024 13:30
@petrkalos petrkalos merged commit 4457130 into main Oct 30, 2024
9 checks passed
@dlpzx dlpzx deleted the feature/share_tests branch November 22, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants