Skip to content

Commit e1ce1ee

Browse files
committed
Refactored TEST_SUITE with free, platinum + removed old YamlRunnerTest
1 parent 35eab26 commit e1ce1ee

20 files changed

+1498
-1211
lines changed

.ci/functions/imports.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require_stack_version
1818
if [[ -z $es_node_name ]]; then
1919
# only set these once
2020
set -euo pipefail
21-
export TEST_SUITE=${TEST_SUITE-oss}
21+
export TEST_SUITE=${TEST_SUITE-free}
2222
export RUNSCRIPTS=${RUNSCRIPTS-}
2323
export DETACH=${DETACH-false}
2424
export CLEANUP=${CLEANUP-false}
@@ -27,8 +27,7 @@ if [[ -z $es_node_name ]]; then
2727
export elastic_password=changeme
2828
export elasticsearch_image=elasticsearch
2929
export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200
30-
if [[ $TEST_SUITE != "xpack" ]]; then
31-
export elasticsearch_image=elasticsearch-${TEST_SUITE}
30+
if [[ $TEST_SUITE != "platinum" ]]; then
3231
export elasticsearch_url=http://${es_node_name}:9200
3332
fi
3433
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}

.ci/run-elasticsearch.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# to form a cluster suitable for running the REST API tests.
55
#
66
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
7-
# Export the TEST_SUITE variable, eg. 'oss' or 'xpack' defaults to 'oss'.
7+
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
88
# Export the NUMBER_OF_NODES variable to start more than 1 node
99

1010
# Version 1.2.0
@@ -39,7 +39,7 @@ environment=($(cat <<-END
3939
--env repositories.url.allowed_urls=http://snapshot.test*
4040
END
4141
))
42-
if [[ "$TEST_SUITE" == "xpack" ]]; then
42+
if [[ "$TEST_SUITE" == "platinum" ]]; then
4343
environment+=($(cat <<-END
4444
--env ELASTIC_PASSWORD=$elastic_password
4545
--env xpack.license.self_generated.type=trial
@@ -64,7 +64,7 @@ END
6464
fi
6565

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

.ci/test-matrix.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP_VERSION:
99
- 7.1-cli
1010

1111
TEST_SUITE:
12-
- oss
12+
- free
13+
- platinum
1314

1415
exclude: ~

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,23 @@ generator/*
2323
# Elasticsearch related
2424
util/elasticsearch/
2525
util/cache/
26+
util/*.zip
27+
util/output/
2628

27-
# Sami docs generator
28-
/sami.phar
29+
# Doctum docs generator
30+
/doctum.phar
2931

3032
# PHPUnit
3133
/phpunit.xml
34+
.phpunit.result.cache
3235

3336
# Code coverage
3437
build
38+
# Do not ignore Doctum docs built files
39+
!/docs/build
3540

3641
# Junit test output
3742
tests/*-junit.xml
43+
44+
# YAML tests
45+
tests/Elasticsearch/Tests/Yaml

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function php_cs() {
1010
->exclude('travis')
1111
->exclude('util/cache')
1212
->exclude('util/elasticsearch')
13+
->exclude('tests/Elasticsearch/Tests/Yaml')
1314
->exclude('vendor')
1415
->in(__DIR__);
1516

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^7.1",
16+
"php": "^7.1 || ^8.0",
1717
"ext-json": ">=1.3.7",
1818
"ezimuel/ringphp": "^1.1.2",
1919
"psr/log": "~1.0"
2020
},
2121
"require-dev": {
22-
"cpliakas/git-wrapper": "~2.0",
22+
"ext-yaml": "*",
23+
"ext-zip": "*",
24+
"cpliakas/git-wrapper": "~2.0 || ~3.0",
2325
"doctrine/inflector": "^1.3",
2426
"mockery/mockery": "^1.2",
2527
"phpstan/phpstan": "^0.12",
26-
"phpunit/phpunit": "^7.5",
28+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
2729
"squizlabs/php_codesniffer": "^3.4",
2830
"symfony/finder": "~4.0",
2931
"symfony/yaml": "~4.0"
@@ -53,7 +55,7 @@
5355
"scripts": {
5456
"phpcs": [
5557
"phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp src",
56-
"phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp tests"
58+
"phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp tests --ignore=tests/Elasticsearch/Tests/Yaml"
5759
],
5860
"phpstan": [
5961
"phpstan analyse src --level 2 --no-progress"

phpunit-integration-tests.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<testsuites>
1212
<testsuite name="Integration tests">
1313
<directory>tests</directory>
14-
<exclude>tests/Elasticsearch/Tests/YamlRunnerTest.php</exclude>
1514
</testsuite>
1615
</testsuites>
1716
<groups>

phpunit-integration.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414
<ini name="error_reporting" value="16383"/>
1515
</php>
1616
<testsuites>
17-
<testsuite name="Integration Tests">
18-
<file>tests/Elasticsearch/Tests/YamlRunnerTest.php</file>
17+
<testsuite name="Yaml tests">
18+
<directory>tests/Elasticsearch/Tests/Yaml/Platinum</directory>
1919
</testsuite>
2020
</testsuites>
21+
<groups>
22+
<include>
23+
<group>platinum</group>
24+
</include>
25+
</groups>
2126
<filter>
2227
<whitelist>
2328
<directory suffix=".php">src</directory>

phpunit-yaml-free-tests.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.3/phpunit.xsd"
4+
bootstrap="tests/bootstrap.php"
5+
colors="true"
6+
failOnRisky="true"
7+
verbose="true"
8+
beStrictAboutChangesToGlobalState="true"
9+
beStrictAboutOutputDuringTests="true"
10+
>
11+
<php>
12+
<!-- Disable E_USER_DEPRECATED setting E_ALL & ~E_USER_DEPRECATED-->
13+
<ini name="error_reporting" value="16383"/>
14+
</php>
15+
<testsuites>
16+
<testsuite name="Yaml tests">
17+
<directory>tests/Elasticsearch/Tests/Yaml/Free</directory>
18+
</testsuite>
19+
</testsuites>
20+
<groups>
21+
<include>
22+
<group>free</group>
23+
</include>
24+
</groups>
25+
<filter>
26+
<whitelist>
27+
<directory suffix=".php">src</directory>
28+
</whitelist>
29+
</filter>
30+
<logging>
31+
<log type="junit" target="tests/yaml-test-junit.xml"/>
32+
</logging>
33+
</phpunit>

phpunit-yaml-platinum-tests.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.3/phpunit.xsd"
4+
bootstrap="tests/bootstrap.php"
5+
colors="true"
6+
failOnRisky="true"
7+
verbose="true"
8+
beStrictAboutChangesToGlobalState="true"
9+
beStrictAboutOutputDuringTests="true"
10+
>
11+
<php>
12+
<env name="ES_TEST_HOST" value="http://localhost:9200"/>
13+
<!-- Disable E_USER_DEPRECATED setting E_ALL & ~E_USER_DEPRECATED-->
14+
<ini name="error_reporting" value="16383"/>
15+
</php>
16+
<testsuites>
17+
<testsuite name="Yaml tests">
18+
<directory>tests/Elasticsearch/Tests/Yaml/Platinum</directory>
19+
</testsuite>
20+
</testsuites>
21+
<groups>
22+
<include>
23+
<group>platinum</group>
24+
</include>
25+
</groups>
26+
<filter>
27+
<whitelist>
28+
<directory suffix=".php">src</directory>
29+
</whitelist>
30+
</filter>
31+
<logging>
32+
<log type="junit" target="tests/yaml-test-junit.xml"/>
33+
</logging>
34+
</phpunit>

phpunit-yaml-tests.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
</php>
1515
<testsuites>
1616
<testsuite name="Yaml tests">
17-
<file>tests/Elasticsearch/Tests/YamlRunnerTest.php</file>
17+
<directory>tests/Elasticsearch/Tests/Yaml/Free</directory>
1818
</testsuite>
1919
</testsuites>
2020
<groups>
2121
<include>
22-
<group>sync</group>
22+
<group>free</group>
2323
</include>
2424
</groups>
2525
<filter>

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
<testsuites>
1212
<testsuite name="Unit tests">
1313
<directory>tests</directory>
14-
<exclude>tests/Elasticsearch/Tests/YamlRunnerTest.php</exclude>
1514
</testsuite>
1615
</testsuites>
1716
<groups>
1817
<exclude>
1918
<group>Integration</group>
19+
<group>free</group>
20+
<group>platinum</group>
2021
</exclude>
2122
</groups>
2223
<filter>

tests/Elasticsearch/Tests/ClientIntegrationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ private function getClient(): Client
5858
$client = ClientBuilder::create()
5959
->setHosts([$this->host])
6060
->setLogger($this->logger);
61-
62-
if (getenv('TEST_SUITE') === 'xpack') {
61+
62+
if (getenv('TEST_SUITE') === 'platinum') {
6363
$client->setSSLVerification(__DIR__ . '/../../../.ci/certs/ca.crt');
6464
}
6565
return $client->build();

0 commit comments

Comments
 (0)