Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit adeefeb

Browse files
committed
check no warning of already existing grant when full_refresh
1 parent 1831c57 commit adeefeb

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

tests/functional/adapter/test_grant_access_to.py

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from dbt.tests.util import run_dbt
6-
6+
import re
77

88
def select_1(dataset: str, materialized: str):
99
config = f"""config(
@@ -87,51 +87,17 @@ def test_grant_access_succeeds(self, project, setup_grant_schema, teardown_grant
8787

8888

8989

90-
class TestAccessGrantSucceedsWithFullRefresh:
91-
@pytest.fixture(scope="class")
92-
def setup_grant_schema(
93-
self,
94-
project,
95-
unique_schema,
96-
):
97-
with project.adapter.connection_named("__test_grants"):
98-
relation = project.adapter.Relation.create(
99-
database=project.database,
100-
schema=get_schema_name(unique_schema),
101-
identifier="grant_access",
102-
)
103-
project.adapter.create_schema(relation)
104-
yield relation
105-
106-
@pytest.fixture(scope="class")
107-
def teardown_grant_schema(
108-
self,
109-
project,
110-
unique_schema,
111-
):
112-
yield
113-
with project.adapter.connection_named("__test_grants"):
114-
relation = project.adapter.Relation.create(
115-
database=project.database, schema=get_schema_name(unique_schema)
116-
)
117-
project.adapter.drop_schema(relation)
118-
119-
@pytest.fixture(scope="class")
120-
def models(self, unique_schema):
121-
dataset = get_schema_name(unique_schema)
122-
return {
123-
"select_1.sql": select_1(dataset=dataset, materialized="view"),
124-
"select_1_table.sql": select_1(dataset=dataset, materialized="table"),
125-
}
126-
127-
def test_grant_access_succeeds(self, project, setup_grant_schema, teardown_grant_schema):
90+
class TestAccessGrantSucceedsWithFullRefresh(TestAccessGrantSucceeds):
91+
def test_grant_access_succeeds(self, project, setup_grant_schema, teardown_grant_schema,capsys):
12892
# Need to run twice to validate idempotency
12993
results = run_dbt(["run"])
13094
assert len(results) == 2
13195
time.sleep(10)
13296
results = run_dbt(["run","--full-refresh"])
13397
assert len(results) == 2
134-
98+
captured = capsys.readouterr()
99+
assert not re.search(r"BigQuery adapter: Access entry <AccessEntry: .* already exists in dataset",captured[0])
100+
135101

136102

137103

0 commit comments

Comments
 (0)