59
59
"default_shards" ,
60
60
"warnings" ,
61
61
"allowed_warnings" ,
62
+ "allowed_warnings_regex" ,
62
63
"contains" ,
63
64
"arbitrary_key" ,
64
65
"transform_and_set" ,
@@ -223,6 +224,11 @@ def run_do(self, action):
223
224
catch = action .pop ("catch" , None )
224
225
warn = action .pop ("warnings" , ())
225
226
allowed_warnings = action .pop ("allowed_warnings" , ())
227
+ if isinstance (allowed_warnings , str ):
228
+ allowed_warnings = (allowed_warnings ,)
229
+ allowed_warnings_regex = action .pop ("allowed_warnings_regex" , ())
230
+ if isinstance (allowed_warnings_regex , str ):
231
+ allowed_warnings_regex = (allowed_warnings_regex ,)
226
232
assert len (action ) == 1
227
233
228
234
# Remove the x_pack_rest_user authentication
@@ -243,6 +249,9 @@ def run_do(self, action):
243
249
244
250
# locate api endpoint
245
251
for m in method .split ("." ):
252
+ # Some deprecated APIs are prefixed with 'xpack-*'
253
+ if m .startswith ("xpack-" ):
254
+ m = m .replace ("xpack-" , "" )
246
255
assert hasattr (api , m )
247
256
api = getattr (api , m )
248
257
@@ -291,7 +300,14 @@ def run_do(self, action):
291
300
str (w .message )
292
301
for w in caught_warnings
293
302
if w .category == ElasticsearchWarning
294
- and str (w .message ) not in allowed_warnings
303
+ and (not allowed_warnings or str (w .message ) not in allowed_warnings )
304
+ and (
305
+ not allowed_warnings_regex
306
+ or all (
307
+ re .search (pattern , str (w .message )) is None
308
+ for pattern in allowed_warnings_regex
309
+ )
310
+ )
295
311
]
296
312
297
313
# This warning can show up in many places but isn't accounted for
@@ -579,7 +595,10 @@ def sync_runner(sync_client):
579
595
# Download the zip and start reading YAML from the files in memory
580
596
package_zip = zipfile .ZipFile (io .BytesIO (http .request ("GET" , package_url ).data ))
581
597
for yaml_file in package_zip .namelist ():
582
- if not re .match (r"^rest-api-spec/test/.*\.ya?ml$" , yaml_file ):
598
+ yaml_filter_pattern = r"^rest-api-spec/%s/.*\.ya?ml$" % (
599
+ "compatTest" if COMPATIBILITY_MODE_ENABLED else "test"
600
+ )
601
+ if not re .match (yaml_filter_pattern , yaml_file ):
583
602
continue
584
603
yaml_tests = list (yaml .safe_load_all (package_zip .read (yaml_file )))
585
604
@@ -608,7 +627,13 @@ def sync_runner(sync_client):
608
627
# is to remove most of the file path prefixes and
609
628
# the .yml suffix.
610
629
pytest_test_name = yaml_file .rpartition ("." )[0 ].replace ("." , "/" )
611
- for prefix in ("rest-api-spec/" , "test/" , "free/" , "platinum/" ):
630
+ for prefix in (
631
+ "rest-api-spec/" ,
632
+ "compatTest/" ,
633
+ "test/" ,
634
+ "free/" ,
635
+ "platinum/" ,
636
+ ):
612
637
if pytest_test_name .startswith (prefix ):
613
638
pytest_test_name = pytest_test_name [len (prefix ) :]
614
639
pytest_param_id = "%s[%d]" % (pytest_test_name , test_number )
0 commit comments