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

Fix user-journey tests for running against non-default targets #1050

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

soapy1
Copy link
Contributor

@soapy1 soapy1 commented Jan 16, 2025

Description

This PR makes a variety of fixes to the user journey tests in order to run them against non default targets (eg. like nebari's conda store deployment). This is required for nebari-dev/nebari#2895

Fix CONDA_STORE_TEST_VERIFY_SSL

Previously setting any value for CONDA_STORE_TEST_VERIFY_SSL resulted in enabling ssl verification. So, setting CONDA_STORE_TEST_VERIFY_SSL=0 or CONDA_STORE_TEST_VERIFY_SSL=false enabled ssl verification. This is because strings are truthy.

This PR fixes this by checking if the passed in env var is one of 0, false or False in order to determine if tests should verify SSL.

Use CONDA_STORE_TOKEN

Previously all but one conda-store user journey tests used the CONDA_STORE_TOKEN as auth when running tests. This PR extends this so that all user journey tests can use the provided auth token for auth.

Ensure new api contexts are valid

Previously, some tests created new utils.API instances. However, the generated tokens had invalid expiry values and did not respect the SSL settings.

Pull request checklist

  • Did you test this change locally?
  • Did you update the documentation (if required)?
  • Did you add/update relevant tests for this change (if required)?

@soapy1 soapy1 requested a review from peytondmurray January 16, 2025 18:23
Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for conda-store ready!

Name Link
🔨 Latest commit 1004ce4
🔍 Latest deploy log https://app.netlify.com/sites/conda-store/deploys/67927d415b4a3c0008d75be9
😎 Deploy Preview https://deploy-preview-1050--conda-store.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@soapy1 soapy1 force-pushed the fix-ssl-verify-test-check branch 2 times, most recently from 5bd0b5e to ed8ef93 Compare January 22, 2025 18:57
@soapy1 soapy1 force-pushed the fix-ssl-verify-test-check branch from ed8ef93 to 2599844 Compare January 22, 2025 19:05
@soapy1 soapy1 changed the title Check CONDA_STORE_TEST_VERIFY_SSL is a falsy value Fix user-journey tests for running against non-default targets Jan 22, 2025
@soapy1 soapy1 marked this pull request as draft January 22, 2025 23:25
@soapy1 soapy1 force-pushed the fix-ssl-verify-test-check branch 2 times, most recently from 4845702 to 4ba3ea9 Compare January 23, 2025 01:40
@soapy1 soapy1 marked this pull request as ready for review January 23, 2025 06:39
Copy link
Contributor

@peytondmurray peytondmurray left a comment

Choose a reason for hiding this comment

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

Thanks for this! Just one minor change requested.

Comment on lines +32 to +33
verify = os.environ.get("CONDA_STORE_TEST_VERIFY_SSL", "true")
return verify.lower() not in ("0", "false")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch 😬

@@ -136,7 +134,7 @@ def create_token(
"""Create a token with a specified role in a specified namespace."""
json_data = {
"primary_namespace": default_namespace,
"expiration": time_utils.get_iso8601_time(1),
# "expiration": time_utils.get_iso8601_time(1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I thought we needed an expiration time? If we don't, let's just remove this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, by default the api will set the expiry to the same expiration as the token that is making the request.

This line in particular was not generating the expiration in the right format so it was causing an error. By removing this line the generated token will get the default expiration value.

@soapy1 soapy1 force-pushed the fix-ssl-verify-test-check branch from 281147a to c34e7c7 Compare January 23, 2025 17:32
@soapy1 soapy1 merged commit 1ce3e6a into conda-incubator:main Jan 23, 2025
30 checks passed
@soapy1 soapy1 deleted the fix-ssl-verify-test-check branch January 23, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 💪🏾
Development

Successfully merging this pull request may close these issues.

2 participants