Skip to content

Commit

Permalink
Refactored TEST_SUITE with free, platinum + removed old YamlRunnerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Feb 18, 2021
1 parent 3fa0b98 commit f69d96f
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 1,295 deletions.
5 changes: 2 additions & 3 deletions .ci/functions/imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require_stack_version
if [[ -z $es_node_name ]]; then
# only set these once
set -euo pipefail
export TEST_SUITE=${TEST_SUITE-oss}
export TEST_SUITE=${TEST_SUITE-free}
export RUNSCRIPTS=${RUNSCRIPTS-}
export DETACH=${DETACH-false}
export CLEANUP=${CLEANUP-false}
Expand All @@ -27,8 +27,7 @@ if [[ -z $es_node_name ]]; then
export elastic_password=changeme
export elasticsearch_image=elasticsearch
export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200
if [[ $TEST_SUITE != "xpack" ]]; then
export elasticsearch_image=elasticsearch-${TEST_SUITE}
if [[ $TEST_SUITE != "platinum" ]]; then
export elasticsearch_url=http://${es_node_name}:9200
fi
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
Expand Down
6 changes: 3 additions & 3 deletions .ci/run-elasticsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# to form a cluster suitable for running the REST API tests.
#
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
# Export the TEST_SUITE variable, eg. 'oss' or 'xpack' defaults to 'oss'.
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
# Export the NUMBER_OF_NODES variable to start more than 1 node

# Version 1.2.0
Expand Down Expand Up @@ -39,7 +39,7 @@ environment=($(cat <<-END
--env repositories.url.allowed_urls=http://snapshot.test*
END
))
if [[ "$TEST_SUITE" == "xpack" ]]; then
if [[ "$TEST_SUITE" == "platinum" ]]; then
environment+=($(cat <<-END
--env ELASTIC_PASSWORD=$elastic_password
--env xpack.license.self_generated.type=trial
Expand All @@ -64,7 +64,7 @@ END
fi

cert_validation_flags=""
if [[ "$TEST_SUITE" == "xpack" ]]; then
if [[ "$TEST_SUITE" == "platinum" ]]; then
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
fi

Expand Down
4 changes: 2 additions & 2 deletions .ci/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PHP_VERSION:
- 7.1-cli

TEST_SUITE:
- oss
- xpack
- free
- platinum

exclude: ~
1 change: 0 additions & 1 deletion phpunit-integration-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<testsuites>
<testsuite name="Integration tests">
<directory>tests</directory>
<exclude>tests/Elasticsearch/Tests/YamlRunnerTest.php</exclude>
</testsuite>
</testsuites>
<groups>
Expand Down
4 changes: 2 additions & 2 deletions phpunit-yaml-oss-tests.xml → phpunit-yaml-free-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
</php>
<testsuites>
<testsuite name="Yaml tests">
<directory>tests/Elasticsearch/Tests/Yaml/Oss</directory>
<directory>tests/Elasticsearch/Tests/Yaml/Free</directory>
</testsuite>
</testsuites>
<groups>
<include>
<group>oss</group>
<group>free</group>
</include>
</groups>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
</php>
<testsuites>
<testsuite name="Yaml tests">
<directory>tests/Elasticsearch/Tests/Yaml/Xpack</directory>
<directory>tests/Elasticsearch/Tests/Yaml/Platinum</directory>
</testsuite>
</testsuites>
<groups>
<include>
<group>xpack</group>
<group>platinum</group>
</include>
</groups>
<filter>
Expand Down
5 changes: 2 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
<testsuites>
<testsuite name="Unit tests">
<directory>tests</directory>
<exclude>tests/Elasticsearch/Tests/YamlRunnerTest.php</exclude>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>Integration</group>
<group>oss</group>
<group>xpack</group>
<group>free</group>
<group>platinum</group>
</exclude>
</groups>
<filter>
Expand Down
2 changes: 1 addition & 1 deletion tests/Elasticsearch/Tests/ClientIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function getClient(): Client
->setHosts([$this->host])
->setLogger($this->logger);

if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
$client->setSSLVerification(__DIR__ . '/../../../.ci/certs/ca.crt');
}
return $client->build();
Expand Down
14 changes: 7 additions & 7 deletions tests/Elasticsearch/Tests/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public static function getHost(): ?string
return $url;
}
switch (getenv('TEST_SUITE')) {
case 'oss':
case 'free':
return 'http://localhost:9200';
case 'xpack':
case 'platinum':
return 'https://elastic:changeme@localhost:9200';
}
return null;
Expand All @@ -57,7 +57,7 @@ public static function getClient(): Client
]
]
]);
if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
$clientBuilder->setSSLVerification(false);
}
return $clientBuilder->build();
Expand Down Expand Up @@ -108,21 +108,21 @@ public static function cleanUpCluster(Client $client): void
*/
private static function wipeCluster(Client $client): void
{
if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
self::wipeRollupJobs($client);
self::waitForPendingRollupTasks($client);
self::deleteAllSLMPolicies($client);
}

self::wipeSnapshots($client);

if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
self::wipeDataStreams($client);
}

self::wipeAllIndices($client);

if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
self::wipeTemplateForXpack($client);
} else {
// Delete templates
Expand All @@ -141,7 +141,7 @@ private static function wipeCluster(Client $client): void

self::wipeClusterSettings($client);

if (getenv('TEST_SUITE') === 'xpack') {
if (getenv('TEST_SUITE') === 'platinum') {
self::deleteAllILMPolicies($client);
self::deleteAllAutoFollowPatterns($client);
self::deleteAllTasks($client);
Expand Down
Loading

0 comments on commit f69d96f

Please sign in to comment.