Skip to content

Commit 3587578

Browse files
committed
fix: end to end schema tests.
1 parent a9095b4 commit 3587578

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/end-to-end/test_api_schema.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_schema_create_with_invalid_json(self):
115115
self._df_api.schemaCreate(
116116
"test_bad_json",
117117
definition="{not valid json",
118+
description="test bad schema"
118119
)
119120

120121
self.assertIn("not valid JSON", str(ctx.exception))
@@ -123,7 +124,9 @@ def test_schema_create_missing_definition(self):
123124
"""Must provide either definition or definition_file."""
124125

125126
with self.assertRaises(Exception) as ctx:
126-
self._df_api.schemaCreate("test_no_def")
127+
self._df_api.schemaCreate("test_no_def",
128+
description="test bad schema"
129+
)
127130

128131
self.assertIn("Must specify", str(ctx.exception))
129132

@@ -135,6 +138,7 @@ def test_schema_create_both_definition_sources(self):
135138
"test_both_def",
136139
definition='{"type": "object", "properties": {}}',
137140
definition_file="/tmp/fake.json",
141+
description="test bad schema"
138142
)
139143

140144
self.assertIn("Cannot specify both", str(ctx.exception))
@@ -246,6 +250,18 @@ def test_schema_search(self):
246250

247251
# Search by ID prefix
248252
search_result = self._df_api.schemaSearch(schema_id=prefix)
253+
254+
def wait_for_search(prefix, expected, timeout=10):
255+
start = time.time()
256+
while time.time() - start < timeout:
257+
res = self._df_api.schemaSearch(schema_id=prefix)
258+
if len(res[0].schema) >= expected:
259+
return res
260+
time.sleep(0.5)
261+
return res
262+
263+
search_result = wait_for_search(prefix, 3, timeout=10)
264+
249265
self.assertEqual(search_result[1], "SchemaDataReply")
250266
self.assertGreaterEqual(len(search_result[0].schema), 3)
251267

@@ -298,6 +314,7 @@ def test_metadata_validate_pass(self):
298314
create_result = self._df_api.schemaCreate(
299315
schema_name,
300316
definition=definition,
317+
description="test bad schema"
301318
)
302319
schema_id = create_result[0].schema[0].id
303320

@@ -322,6 +339,7 @@ def test_metadata_validate_fail(self):
322339
create_result = self._df_api.schemaCreate(
323340
schema_name,
324341
definition=definition,
342+
description="test bad schema"
325343
)
326344
schema_id = create_result[0].schema[0].id
327345

0 commit comments

Comments
 (0)