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

Update database role tests to avoid colliding with parallel test runs #1197

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/functional/auth_tests/test_database_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ def project_config_update(self):
return {"models": {"+grants": {"select": [os.getenv("SNOWFLAKE_TEST_ROLE")]}}}

@pytest.fixture(scope="class", autouse=True)
def setup(self, project):
def setup(self, project, prefix):
"""
Create a database role with access to the model we're about to create.
The existence of this database role triggered the bug as dbt-snowflake attempts
to revoke it if the user also provides a grants config.
"""
role = "BLOCKING_DB_ROLE"
role = f"BLOCKING_DB_ROLE_{prefix}"
project.run_sql(f"CREATE DATABASE ROLE {role}")
sql = f"""
GRANT
ALL PRIVILEGES ON FUTURE TABLES
IN DATABASE {project.database}
IN SCHEMA {project.test_schema}
TO DATABASE ROLE {role}
"""
project.run_sql(sql)
Expand Down