Skip to content

Commit

Permalink
[WIP] Refactoring YAML runner test for 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Mar 2, 2022
1 parent 24656b9 commit fdfb0c1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=7.4-cli
ARG PHP_VERSION=8.0-cli
FROM php:${PHP_VERSION}

WORKDIR /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion .ci/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=7.4-cli
ARG PHP_VERSION=8.0-cli
FROM php:${PHP_VERSION}

# Create app directory
Expand Down
2 changes: 1 addition & 1 deletion phpunit-yaml-platinum-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</php>
<testsuites>
<testsuite name="Yaml tests">
<directory>tests/Elasticsearch/Tests/Yaml/Platinum</directory>
<directory>tests/Yaml/Platinum</directory>
</testsuite>
</testsuites>
<groups>
Expand Down
4 changes: 2 additions & 2 deletions tests/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Exception;
use Elastic\Elasticsearch\Client;
use Elastic\Elasticsearch\ClientBuilder;
use Elastic\Elasticsearch\Exceptions\ElasticsearchException;
use Elastic\Elasticsearch\Exception\ElasticsearchException;

class Utility
{
Expand Down Expand Up @@ -333,7 +333,7 @@ private static function waitForPendingTasks(Client $client, string $filter, int
$result = $client->cat()->tasks([
'detailed' => true
]);
$tasks = explode("\n", $result);
$tasks = explode("\n", $result->asString());
$count = 0;
foreach ($tasks as $task) {
if (empty($task)) {
Expand Down
14 changes: 3 additions & 11 deletions util/RestSpecRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,15 @@
* the GNU Lesser General Public License, Version 2.1, at your option.
* See the LICENSE file in the project root for more information.
*/


declare(strict_types = 1);

use Elastic\Transport\Exception\NoNodeAvailableException;
use Elastic\Elasticsearch\Tests\Utility;

// Set the default timezone. While this doesn't cause any tests to fail, PHP
// complains if it is not set in 'date.timezone' of php.ini.
// Set the default timezone. While this doesn't cause any tests to fail,
// PHP can complains if it is not set in 'date.timezone' of php.ini.
date_default_timezone_set('UTC');

// Ensure that composer has installed all dependencies
if (!file_exists(dirname(__DIR__) . '/composer.lock')) {
die("Dependencies must be installed using composer:\n\nphp composer.phar install --dev\n\n"
. "See http://getcomposer.org for help with installing composer\n");
}

require dirname(__DIR__) . '/vendor/autoload.php';

printf("********************************************************\n");
Expand All @@ -46,8 +38,8 @@
printf ("ERROR: Host %s is offline\n", Utility::getHost());
exit(1);
}

$version = $serverInfo['version']['number'];

$artifactFile = sprintf("rest-resources-zip-%s.zip", $version);
$tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $serverInfo['version']['build_hash']);

Expand Down
1 change: 1 addition & 0 deletions util/YamlTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private function getAllTests(string $dir): array
// Iterate over the Yaml test files
foreach (new RecursiveIteratorIterator($it) as $file) {
if ($file->getExtension() === 'yml') {
printf ("Parsing file %s\n", $file->getPathname());
$test = yaml_parse_file($file->getPathname(), -1, $ndocs, [
YAML_MAP_TAG => function($value, $tag, $flags) {
return empty($value) ? new stdClass : $value;
Expand Down

0 comments on commit fdfb0c1

Please sign in to comment.