Skip to content

Commit af8afa6

Browse files
committed
test fix
1 parent da89940 commit af8afa6

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

tests/catalog/integration_test_bigquery_metastore.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from tests.conftest import BQ_TABLE_METADATA_LOCATION_REGEX
3131

3232

33+
@pytest.mark.skipif(os.environ.get("GCP_CREDENTIALS") is None)
3334
def test_create_table_with_database_location(
3435
mocker: MockFixture, _bucket_initialize: None, table_schema_nested: Schema, gcp_dataset_name: str, table_name: str
3536
) -> None:
@@ -38,7 +39,12 @@ def test_create_table_with_database_location(
3839
catalog_name = "test_ddb_catalog"
3940
identifier = (gcp_dataset_name, table_name)
4041
test_catalog = BigQueryMetastoreCatalog(
41-
catalog_name, **{"gcp.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
42+
catalog_name,
43+
**{
44+
"gcp.bigquery.project-id": "alexstephen-test-1",
45+
"warehouse": "gs://alexstephen-test-bq-bucket/",
46+
"gcp.bigquery.credentials-info": os.environ["GCP_CREDENTIALS"],
47+
},
4248
)
4349
test_catalog.create_namespace(namespace=gcp_dataset_name)
4450
table = test_catalog.create_table(identifier, table_schema_nested)
@@ -49,6 +55,7 @@ def test_create_table_with_database_location(
4955
assert identifier in tables_in_namespace
5056

5157

58+
@pytest.mark.skipif(os.environ.get("GCP_CREDENTIALS") is None)
5259
def test_drop_table_with_database_location(
5360
mocker: MockFixture, _bucket_initialize: None, table_schema_nested: Schema, gcp_dataset_name: str, table_name: str
5461
) -> None:
@@ -57,7 +64,12 @@ def test_drop_table_with_database_location(
5764
catalog_name = "test_ddb_catalog"
5865
identifier = (gcp_dataset_name, table_name)
5966
test_catalog = BigQueryMetastoreCatalog(
60-
catalog_name, **{"gcp.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
67+
catalog_name,
68+
**{
69+
"gcp.bigquery.project-id": "alexstephen-test-1",
70+
"warehouse": "gs://alexstephen-test-bq-bucket/",
71+
"gcp.bigquery.credentials-info": os.environ["GCP_CREDENTIALS"],
72+
},
6173
)
6274
test_catalog.create_namespace(namespace=gcp_dataset_name)
6375
test_catalog.create_table(identifier, table_schema_nested)
@@ -74,6 +86,7 @@ def test_drop_table_with_database_location(
7486
assert True
7587

7688

89+
@pytest.mark.skipif(os.environ.get("GCP_CREDENTIALS") is None)
7790
def test_create_and_drop_namespace(
7891
mocker: MockFixture, _bucket_initialize: None, table_schema_nested: Schema, gcp_dataset_name: str, table_name: str
7992
) -> None:
@@ -82,7 +95,12 @@ def test_create_and_drop_namespace(
8295
# Create namespace.
8396
catalog_name = "test_ddb_catalog"
8497
test_catalog = BigQueryMetastoreCatalog(
85-
catalog_name, **{"gcp.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
98+
catalog_name,
99+
**{
100+
"gcp.bigquery.project-id": "alexstephen-test-1",
101+
"warehouse": "gs://alexstephen-test-bq-bucket/",
102+
"gcp.bigquery.credentials-info": os.environ["GCP_CREDENTIALS"],
103+
},
86104
)
87105
test_catalog.create_namespace(namespace=gcp_dataset_name)
88106

@@ -100,6 +118,7 @@ def test_create_and_drop_namespace(
100118
test_catalog.load_namespace_properties(gcp_dataset_name)
101119

102120

121+
@pytest.mark.skipif(os.environ.get("GCP_CREDENTIALS") is None)
103122
def test_register_table(
104123
mocker: MockFixture, _bucket_initialize: None, table_schema_nested: Schema, gcp_dataset_name: str, table_name: str
105124
) -> None:
@@ -108,9 +127,15 @@ def test_register_table(
108127
catalog_name = "test_bq_register_catalog"
109128
identifier = (gcp_dataset_name, table_name)
110129
warehouse_path = "gs://alexstephen-test-bq-bucket/" # Matches conftest BUCKET_NAME for GCS interaction
111-
gcp_project_id = "alexstephen-test-1"
112130

113-
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.project-id": gcp_project_id, "warehouse": warehouse_path})
131+
test_catalog = BigQueryMetastoreCatalog(
132+
catalog_name,
133+
**{
134+
"gcp.bigquery.project-id": "alexstephen-test-1",
135+
"warehouse": "gs://alexstephen-test-bq-bucket/",
136+
"gcp.bigquery.credentials-info": os.environ["GCP_CREDENTIALS"],
137+
},
138+
)
114139

115140
test_catalog.create_namespace(namespace=gcp_dataset_name)
116141

tests/catalog/test_bigquery_metastore.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_create_table_with_database_location(
6464
catalog_name = "test_ddb_catalog"
6565
identifier = (gcp_dataset_name, table_name)
6666
test_catalog = BigQueryMetastoreCatalog(
67-
catalog_name, **{"gcp.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
67+
catalog_name, **{"gcp.bigquery.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
6868
)
6969
test_catalog.create_namespace(namespace=gcp_dataset_name)
7070
table = test_catalog.create_table(identifier, table_schema_nested)
@@ -89,7 +89,7 @@ def test_drop_table_with_database_location(
8989
catalog_name = "test_ddb_catalog"
9090
identifier = (gcp_dataset_name, table_name)
9191
test_catalog = BigQueryMetastoreCatalog(
92-
catalog_name, **{"gcp.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
92+
catalog_name, **{"gcp.bigquery.project-id": "alexstephen-test-1", "warehouse": "gs://alexstephen-test-bq-bucket/"}
9393
)
9494
test_catalog.create_namespace(namespace=gcp_dataset_name)
9595
test_catalog.create_table(identifier, table_schema_nested)
@@ -112,7 +112,7 @@ def test_drop_namespace(mocker: MockFixture, gcp_dataset_name: str) -> None:
112112
mocker.patch.dict(os.environ, values={"PYICEBERG_LEGACY_CURRENT_SNAPSHOT_ID": "True"})
113113

114114
catalog_name = "test_catalog"
115-
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.project-id": "alexstephen-test-1"})
115+
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.bigquery.project-id": "alexstephen-test-1"})
116116

117117
test_catalog.drop_namespace(gcp_dataset_name)
118118
client_mock.delete_dataset.assert_called_once()
@@ -147,7 +147,7 @@ def test_list_tables(mocker: MockFixture, gcp_dataset_name: str) -> None:
147147
mocker.patch.dict(os.environ, values={"PYICEBERG_LEGACY_CURRENT_SNAPSHOT_ID": "True"})
148148

149149
catalog_name = "test_catalog"
150-
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.project-id": "my-project"})
150+
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.bigquery.project-id": "my-project"})
151151

152152
tables = test_catalog.list_tables(gcp_dataset_name)
153153

@@ -169,7 +169,7 @@ def test_list_namespaces(mocker: MockFixture) -> None:
169169
mocker.patch.dict(os.environ, values={"PYICEBERG_LEGACY_CURRENT_SNAPSHOT_ID": "True"})
170170

171171
catalog_name = "test_catalog"
172-
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.project-id": "my-project"})
172+
test_catalog = BigQueryMetastoreCatalog(catalog_name, **{"gcp.bigquery.project-id": "my-project"})
173173

174174
namespaces = test_catalog.list_namespaces()
175175
assert len(namespaces) == 2

0 commit comments

Comments
 (0)