Skip to content

Commit

Permalink
add back the underscores to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Apr 24, 2024
1 parent a5d151b commit 63ec37c
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions tests/functional/context_methods/test_env_vars.py
Original file line number Diff line number Diff line change
@@ -56,13 +56,13 @@ def setup(self):
os.environ["DBT_TEST_ENV_VAR"] = "1"
os.environ["DBT_TEST_USER"] = "root"
os.environ["DBT_TEST_PASS"] = "password"
os.environ[SECRET_ENV_PREFIX + "SECRET"] = "secret_variable"
os.environ[SECRET_ENV_PREFIX + "_SECRET"] = "secret_variable"
os.environ["DBT_TEST_NOT_SECRET"] = "regular_variable"
os.environ["DBT_TEST_IGNORE_DEFAULT"] = "ignored_default"
yield
del os.environ["DBT_TEST_ENV_VAR"]
del os.environ["DBT_TEST_USER"]
del os.environ[SECRET_ENV_PREFIX + "SECRET"]
del os.environ[SECRET_ENV_PREFIX + "_SECRET"]
del os.environ["DBT_TEST_NOT_SECRET"]
del os.environ["DBT_TEST_IGNORE_DEFAULT"]

16 changes: 8 additions & 8 deletions tests/functional/context_methods/test_secret_env_vars.py
Original file line number Diff line number Diff line change
@@ -73,15 +73,15 @@ def test_disallow_secret(self, project):
class TestAllowSecretProfilePackage(FirstDependencyProject):
@pytest.fixture(scope="class", autouse=True)
def setup(self):
os.environ[SECRET_ENV_PREFIX + "USER"] = "root"
os.environ[SECRET_ENV_PREFIX + "PASS"] = "password"
os.environ[SECRET_ENV_PREFIX + "PACKAGE"] = "first_dependency"
os.environ[SECRET_ENV_PREFIX + "GIT_TOKEN"] = "abc123"
os.environ[SECRET_ENV_PREFIX + "_USER"] = "root"
os.environ[SECRET_ENV_PREFIX + "_PASS"] = "password"
os.environ[SECRET_ENV_PREFIX + "_PACKAGE"] = "first_dependency"
os.environ[SECRET_ENV_PREFIX + "_GIT_TOKEN"] = "abc123"
yield
del os.environ[SECRET_ENV_PREFIX + "USER"]
del os.environ[SECRET_ENV_PREFIX + "PASS"]
del os.environ[SECRET_ENV_PREFIX + "PACKAGE"]
del os.environ[SECRET_ENV_PREFIX + "GIT_TOKEN"]
del os.environ[SECRET_ENV_PREFIX + "_USER"]
del os.environ[SECRET_ENV_PREFIX + "_PASS"]
del os.environ[SECRET_ENV_PREFIX + "_PACKAGE"]
del os.environ[SECRET_ENV_PREFIX + "_GIT_TOKEN"]

@pytest.fixture(scope="class")
def models(self):
6 changes: 3 additions & 3 deletions tests/functional/partial_parsing/test_pp_vars.py
Original file line number Diff line number Diff line change
@@ -366,7 +366,7 @@ def dbt_profile_target(self):

# user is secret and password is not. postgres on macos doesn't care if the password
# changes so we have to change the user. related: https://github.com/dbt-labs/dbt-core/pull/4250
os.environ[SECRET_ENV_PREFIX + "USER"] = "root"
os.environ[SECRET_ENV_PREFIX + "_USER"] = "root"
os.environ["ENV_VAR_PASS"] = "password"
return {
"type": "postgres",
@@ -381,15 +381,15 @@ def dbt_profile_target(self):
def test_profile_secret_env_vars(self, project):

# Initial run
os.environ[SECRET_ENV_PREFIX + "USER"] = "root"
os.environ[SECRET_ENV_PREFIX + "_USER"] = "root"
os.environ["ENV_VAR_PASS"] = "password"

results = run_dbt(["run"])
manifest = get_manifest(project.project_root)
env_vars_checksum = manifest.state_check.profile_env_vars_hash.checksum

# Change a secret var, it shouldn't register because we shouldn't save secrets.
os.environ[SECRET_ENV_PREFIX + "USER"] = "fake_user"
os.environ[SECRET_ENV_PREFIX + "_USER"] = "fake_user"
# we just want to see if the manifest has included
# the secret in the hash of environment variables.
(results, log_output) = run_dbt_and_capture(["run"], expect_pass=True)

0 comments on commit 63ec37c

Please sign in to comment.