Skip to content

Commit

Permalink
[TEST] Use tests from corresponding ES version (#649)
Browse files Browse the repository at this point in the history
* [TEST] Drop ES 5.5 from TravisCI build matrix

* [TEST] run tests for exactly same version the server has

* [Travis] allow_failures on ES 6.x
  • Loading branch information
mhujer authored and polyfractal committed Nov 14, 2017
1 parent 800b1ec commit 75c6680
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ The process for contributing to any of the Elasticsearch repositories is similar
-Des.index.store.type=memory -Des.discovery.zen.ping.multicast.enabled=false \
-Des.node.bench=true -Des.script.disable_dynamic=false

4. Run the unit and yaml integration tests to ensure your changes do not break existing code. The exported `TEST_BUILD_REF` should match the branch of Elasticsearch that is running on your machine (since tests are specific to the server version):
4. Run the unit and yaml integration tests to ensure your changes do not break existing code. The `util/RestSpecRunner.php` script will automatically checkout the tests for the exact same build as is the Elasticsearch you are running on your machine (since tests are specific to the server version):

$> export TEST_BUILD_REF='origin/1.x'
$> export ES_TEST_HOST='http://localhost:9200'

Then proceed to initialize the REST yaml tests and run the package. **WARNING: the unit tests will clear your cluster
Expand Down
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ matrix:
fast_finish: true
include:
- php: 7.0
env: ES_VERSION="5.5" TEST_BUILD_REF="origin/5.5"
env: ES_VERSION="6.0"
- php: 7.0
env: ES_VERSION="6.0" TEST_BUILD_REF="origin/6.0"
- php: 7.0
env: ES_VERSION="6.x" TEST_BUILD_REF="origin/6.x"
env: ES_VERSION="6.x"

- php: 7.1
env: ES_VERSION="5.5" TEST_BUILD_REF="origin/5.5"
- php: 7.1
env: ES_VERSION="6.0" TEST_BUILD_REF="origin/6.0"
env: ES_VERSION="6.0"
- php: 7.1
env: ES_VERSION="6.x" TEST_BUILD_REF="origin/6.x"
env: ES_VERSION="6.x"

- php: 7.2
env: ES_VERSION="6.0" TEST_BUILD_REF="origin/6.0"
env: ES_VERSION="6.0"

allow_failures:
- env: ES_VERSION="6.x"

env:
global:
Expand Down
8 changes: 7 additions & 1 deletion util/RestSpecRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@
// Include the composer autoloader
$autoloader = require_once(dirname(__DIR__) . '/vendor/autoload.php');

$client = \Elasticsearch\ClientBuilder::fromConfig([
'hosts' => [$_SERVER['ES_TEST_HOST']]
]);
$serverInfo = $client->info();
var_dump($serverInfo);

$gitWrapper = new \GitWrapper\GitWrapper();
echo "Git cwd: ".dirname(__DIR__) . "/util/elasticsearch\n";
$git = $gitWrapper->workingCopy(dirname(__DIR__) . '/util/elasticsearch');

echo "Update elasticsearch submodule\n";
$git->fetchAll(array('verbose' => true));

$hash = $_SERVER['TEST_BUILD_REF'];
$hash = $serverInfo['version']['build_hash'];
echo "Checkout yaml tests (hash: $hash)\n";
$git->checkout($hash, array('force' => true, 'quiet' => true));

0 comments on commit 75c6680

Please sign in to comment.