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

Tests and improvements for secrets in cloud subdirectories #8791

Merged
merged 20 commits into from
Jan 24, 2024

Conversation

radeusgd
Copy link
Member

@radeusgd radeusgd commented Jan 17, 2024

Pull Request Description

  • Closes Ensure Enso Secrets can work within the Enso Folder Structure #8723
  • Adds some missing features that were needed to make this work:
    • Enso_File.create_directory and Enso_File.delete, and basic tests for it
    • Changes how Enso_Secret.list is obtained - using a different Cloud endpoint allows us to implement the desired logic, the default endpoint was giving us all secrets which was not what we wanted here.
    • Implements Enso_Secret.update and tests for it

Important Notes

Notes describing any problems with the current Cloud API:
https://docs.google.com/document/d/1x8RUt3KkwyhlxGux7XUGfOdtFSAZV3fI9lSSqQ3XsXk/edit

Apparently, everything that was needed to make this feature work has already been implemented, although a few features needed workarounds on Enso side to work properly.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@radeusgd radeusgd added the CI: No changelog needed Do not require a changelog entry for this PR. label Jan 17, 2024
@radeusgd radeusgd self-assigned this Jan 17, 2024
@radeusgd radeusgd changed the base branch from develop to wip/radeusgd/8722-secrets-in-aws-cred January 17, 2024 16:02
@radeusgd radeusgd force-pushed the wip/radeusgd/8722-secrets-in-aws-cred branch from 5abfa9f to 850a054 Compare January 18, 2024 09:14
@radeusgd radeusgd force-pushed the wip/radeusgd/8723-secrets-in-folders branch from b14189a to 7eb5a72 Compare January 18, 2024 09:14
@radeusgd radeusgd marked this pull request as ready for review January 18, 2024 12:04
@@ -1,3 +1,4 @@
private
Copy link
Member Author

@radeusgd radeusgd Jan 18, 2024

Choose a reason for hiding this comment

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

@JaroslavTulach per your suggestion on using the private keyword more, I thought that it may make sense to mark this module as private, so I did!

It only required moving as_hideable_value elsewhere (but I assume the new place actually fits it better anyway), because it needs to be usable in other libraries (e.g. AWS).

@radeusgd radeusgd force-pushed the wip/radeusgd/8722-secrets-in-aws-cred branch from 850a054 to d018d38 Compare January 18, 2024 13:09
@radeusgd radeusgd force-pushed the wip/radeusgd/8723-secrets-in-folders branch from 3929af5 to ec3dffd Compare January 18, 2024 13:09
@radeusgd radeusgd force-pushed the wip/radeusgd/8723-secrets-in-folders branch 4 times, most recently from 2c09f61 to 53d690d Compare January 19, 2024 15:52
Base automatically changed from wip/radeusgd/8722-secrets-in-aws-cred to develop January 19, 2024 19:00
@radeusgd radeusgd force-pushed the wip/radeusgd/8723-secrets-in-folders branch from b20faae to c3c0a37 Compare January 22, 2024 07:47
… everything relevant is covered by Enso_User tests below
Comment on lines -18 to -32
Test.group "Enso Cloud Basic Utils" pending=setup.pending <|
Test.specify "will report Not_Logged_In if no credentials file is found" <|
non_existent_file = (enso_project.data / "nonexistent-file") . absolute . normalize
non_existent_file.exists.should_be_false

Test_Environment.unsafe_with_environment_override "ENSO_CLOUD_CREDENTIALS_FILE" non_existent_file.path <|
# This test has to run before any other Cloud access, otherwise the token may already be cached.
Cloud_Utils.authorization_header.should_fail_with Cloud_Utils.Not_Logged_In

Test.specify "should be able to get the cloud URL from environment" <|
api_url = Cloud_Utils.cloud_root_uri
api_url.should_equal setup.api_url.to_text

Test.specify "should be able to read the authorization token" pending=setup.mock_only_pending <|
Cloud_Utils.authorization_header.to_display_text.should_equal "Authorization: Bearer "+Cloud_Tests_Setup.test_token
Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed these tests, because they were checking private implementation details (and I think we are not yet skipping private check for tests).

IMO it was OK to remove because everything relevant is covered by Enso_User tests below which should be run on CI because they only rely on the http-test-helper mock, which is available on CI.

So IMO there was not much added value in these whitebox tests.

@radeusgd radeusgd added the CI: Ready to merge This PR is eligible for automatic merge label Jan 23, 2024
@mergify mergify bot merged commit edfcfde into develop Jan 24, 2024
27 of 28 checks passed
@mergify mergify bot deleted the wip/radeusgd/8723-secrets-in-folders branch January 24, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure Enso Secrets can work within the Enso Folder Structure
3 participants