Skip to content

Commit

Permalink
fix: WANNA_GCP_ENABLE_REMOTE_VALIDATION logic (#98)
Browse files Browse the repository at this point in the history
## Describe your changes

fixes #97 but we can talk about the fix and maybe we should invert the
logic of the disabling while keeping the name of the environment
variable?

## Issue ticket number and link

## Checklist before requesting a review
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
  • Loading branch information
racinmat authored Aug 16, 2023
2 parents 897aaad + 00a4d6f commit 4e3121e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/wanna/core/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def _gcp_access_allowed(env_var="WANNA_GCP_ACCESS_ALLOWED"):
gcp_access_allowed = _gcp_access_allowed()


def _should_validate(env_var="WANNA_GCP_DISABLE_REMOTE_VALIDATION"):
def _should_validate(env_var="WANNA_GCP_ENABLE_REMOTE_VALIDATION"):
"""
Based on WANNA_GCP_DISABLE_REMOTE_VALIDATION env var checks if wanna should
Based on WANNA_GCP_ENABLE_REMOTE_VALIDATION env var checks if wanna should
run remote validations that access GCP APIs.
This is mostly to improve development experience, as it can be slow to allways
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def test_gcp_should_validate_env(self):
# Ensure GCP validation are disabled due to `WANNA_GCP_VALIDATION_DISABLED` env
self.assertEqual(_should_validate(), True)

os.environ["WANNA_GCP_DISABLE_REMOTE_VALIDATION"] = "False"
os.environ["WANNA_GCP_ENABLE_REMOTE_VALIDATION"] = "False"
self.assertEqual(_should_validate(), False)

os.environ["WANNA_GCP_DISABLE_REMOTE_VALIDATION"] = "True"
os.environ["WANNA_GCP_ENABLE_REMOTE_VALIDATION"] = "True"
self.assertEqual(_should_validate(), True)

def test_cloud_build_access_allowed(self):
Expand Down

0 comments on commit 4e3121e

Please sign in to comment.