@@ -336,6 +336,38 @@ private function length(array $actions)
336
336
]);
337
337
}
338
338
339
+ private function requires (array $ requires )
340
+ {
341
+ if (isset ($ requires ['test_runner_features ' ])) {
342
+ if (is_string ($ requires ['test_runner_features ' ])) {
343
+ $ requires ['test_runner_features ' ] = [$ requires ['test_runner_features ' ]];
344
+ }
345
+ foreach ($ requires ['test_runner_features ' ] as $ req ) {
346
+ if (!in_array ($ requires ['test_runner_features ' ], self ::SUPPORTED_FEATURES )) {
347
+ return YamlTests::render (self ::TEMPLATE_SKIP_FEATURE , [
348
+ ':testname ' => "__CLASS__ . '::' . __FUNCTION__ " ,
349
+ ':feature ' => sprintf ("'%s' " , $ req )
350
+ ]);
351
+ }
352
+ }
353
+ }
354
+ if (isset ($ requires ['cluster_features ' ])) {
355
+ if (is_string ($ requires ['cluster_features ' ])) {
356
+ $ part = explode ('_ ' , $ requires ['cluster_features ' ]);
357
+ if ($ part [0 ] === 'gte ' ) {
358
+ $ version = str_replace ('v ' ,'' , $ part [1 ]);
359
+ if (version_compare (YamlTests::$ esVersion , $ version , '< ' )) {
360
+ return YamlTests::render (self ::TEMPLATE_SKIP_VERSION , [
361
+ ':testname ' => "__CLASS__ . '::' . __FUNCTION__ " ,
362
+ ':esversion ' => sprintf ("'%s' " , YamlTests::$ esVersion ),
363
+ ':reason ' => sprintf ("'%s' " , $ requires ['reason ' ] ?? '' )
364
+ ]);
365
+ }
366
+ }
367
+ }
368
+ }
369
+ }
370
+
339
371
private function skip (array $ actions )
340
372
{
341
373
if (isset ($ actions ['version ' ]) && isset ($ actions ['reason ' ])) {
@@ -388,7 +420,21 @@ private function skip(array $actions)
388
420
break ;
389
421
}
390
422
}
391
-
423
+ }
424
+ if (isset ($ actions ['cluster_features ' ])) {
425
+ if (is_string ($ actions ['cluster_features ' ])) {
426
+ $ part = explode ('_ ' , $ actions ['cluster_features ' ]);
427
+ if ($ part [0 ] === 'gte ' ) {
428
+ $ version = str_replace ('v ' ,'' , $ part [1 ]);
429
+ if (version_compare (YamlTests::$ esVersion , $ version , '>= ' )) {
430
+ return YamlTests::render (self ::TEMPLATE_SKIP_VERSION , [
431
+ ':testname ' => "__CLASS__ . '::' . __FUNCTION__ " ,
432
+ ':esversion ' => sprintf ("'%s' " , YamlTests::$ esVersion ),
433
+ ':reason ' => sprintf ("'%s' " , $ actions ['reason ' ] ?? '' )
434
+ ]);
435
+ }
436
+ }
437
+ }
392
438
}
393
439
}
394
440
0 commit comments