Skip to content

Commit 937f047

Browse files
minor updates
1 parent 9c6d74c commit 937f047

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

smoke-test/tests/cli/ingest_cmd/test_ingest_golden_files_in_repo.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import logging
23
import os
34
import tempfile
45
from pathlib import Path
@@ -13,6 +14,18 @@
1314
pytestmark = pytest.mark.order("last")
1415

1516

17+
SKIPPED_GOLDEN_FILES = {
18+
# skip because of missing structured property definitions
19+
"datahub/metadata-ingestion/tests/unit/sdk_v2/dataset_golden/test_structured_properties_golden.json",
20+
# skip because of missing structured property definitions
21+
"datahub/metadata-ingestion/tests/integration/snowflake/snowflake_structured_properties_golden.json",
22+
# skip because of missing structured property definitions
23+
"datahub/metadata-ingestion/tests/unit/cli/dataset/test_resources/golden_test_dataset_sync_mpcs.json",
24+
}
25+
26+
logger = logging.getLogger(__name__)
27+
28+
1629
@pytest.fixture(scope="module")
1730
def golden_files():
1831
repo_root = Path(__file__).parents[5]
@@ -65,7 +78,7 @@ def cleanup_golden_files(auth_session, golden_files):
6578

6679
# after yield => teardown method
6780

68-
print("Collecting URNs from all golden files for batch deletion...")
81+
logger.info("Collecting URNs from all golden files for batch deletion...")
6982

7083
all_urns = set()
7184

@@ -94,10 +107,12 @@ def cleanup_golden_files(auth_session, golden_files):
94107
all_urns.add(urn)
95108

96109
except Exception as e:
97-
print(f"Warning: Failed to extract URNs from {file_path}: {e}")
110+
logger.error(
111+
f"Warning: Failed to extract URNs from {file_path}", exc_info=e
112+
)
98113

99114
if all_urns:
100-
print(
115+
logger.info(
101116
f"Creating temp file with {len(all_urns)} unique URNs for batch deletion..."
102117
)
103118

@@ -123,9 +138,9 @@ def cleanup_golden_files(auth_session, golden_files):
123138
},
124139
)
125140
if result.exit_code == 0:
126-
print("✅ Batch deletion completed successfully")
141+
logger.info("✅ Batch deletion completed successfully")
127142
else:
128-
print(f"⚠️ Batch deletion failed: {result.output}")
143+
logger.info(f"⚠️ Batch deletion failed: {result.output}")
129144

130145
finally:
131146
os.unlink(temp_file_path)
@@ -142,27 +157,20 @@ def test_golden_files_discovery(golden_files):
142157
assert os.path.isabs(file_path), f"Path should be absolute: {file_path}"
143158
assert os.path.exists(file_path), f"File should exist: {file_path}"
144159

145-
print(f"Successfully discovered {len(golden_files)} golden files")
160+
logger.info(f"Successfully discovered {len(golden_files)} golden files")
146161

147162

148163
def test_ingest_golden_files(auth_session, golden_files):
149164
repo_root = Path(__file__).parents[5]
150165
failed_files = []
151166

152-
# TODO: Fix these failing golden files
153-
known_failing_files = {
154-
"datahub/metadata-ingestion/tests/unit/sdk_v2/dataset_golden/test_structured_properties_golden.json",
155-
"datahub/metadata-ingestion/tests/integration/snowflake/snowflake_structured_properties_golden.json",
156-
"datahub/metadata-ingestion/tests/unit/cli/dataset/test_resources/golden_test_dataset_sync_mpcs.json",
157-
}
158-
159167
for golden_file_path in golden_files:
160168
relative_path = Path(golden_file_path).relative_to(repo_root)
161-
print(f"Testing ingestion of golden file: {relative_path}")
169+
logger.info(f"Testing ingestion of golden file: {relative_path}")
162170

163171
# Skip known failing files temporarily
164-
if str(relative_path) in known_failing_files:
165-
print(f"Skipping known failing file: {relative_path} ⚠️")
172+
if str(relative_path) in SKIPPED_GOLDEN_FILES:
173+
logger.info(f"Skipping known failing file: {relative_path} ⚠️")
166174
continue
167175

168176
try:
@@ -173,9 +181,10 @@ def test_ingest_golden_files(auth_session, golden_files):
173181
"DATAHUB_GMS_TOKEN": auth_session.gms_token(),
174182
},
175183
)
176-
print(
177-
f"Ingestion of golden file {relative_path}: {'✅' if result.exit_code == 0 else '❌'}"
178-
)
184+
if result.exit_code == 0:
185+
logger.info(f"Ingestion of golden file {relative_path}: ✅")
186+
else:
187+
logger.warning(f"Ingestion of golden file {relative_path}: ❌")
179188

180189
if result.exit_code != 0:
181190
failed_files.append(f"{relative_path}: {result.output}")

0 commit comments

Comments
 (0)