Skip to content

Commit 6374312

Browse files
committed
Fixed build_tests for .x or -snapshot versions
1 parent 4e03a25 commit 6374312

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

util/build_tests.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
*/
1515
declare(strict_types = 1);
1616

17+
use Elasticsearch\Common\Exceptions\ElasticsearchException;
1718
use Elasticsearch\Util\YamlTests;
19+
use Elasticsearch\Tests\Utility;
1820

1921
require __DIR__ . '/../vendor/autoload.php';
2022

@@ -23,8 +25,18 @@
2325
printf ("where <ES_VERSION> is Elasticsearch semantic version and <TEST_SUITE> is 'oss' or 'xpack'\n");
2426
exit(1);
2527
}
26-
2728
$version = $argv[1];
29+
if (false !== strpos($version, '.x')) {
30+
$client = Utility::getClient();
31+
try {
32+
$result = $client->info();
33+
$version = $result['version']['number'] ?? '';
34+
} catch (ElasticsearchException $e) {
35+
printf ("The %s specified is not a valid semantic version number.\n", $version);
36+
exit(1);
37+
}
38+
}
39+
$version = str_replace('-snapshot', '', strtolower($version));
2840
if (!version_compare($version, '0.0.1', '>=')) {
2941
printf ("The argument <ES_VERSION> should be a valid semantic version number\n");
3042
exit(1);

0 commit comments

Comments
 (0)