Skip to content

Commit b66ad43

Browse files
Add integration and yaml tests to 8.19 build (#1503)
* Add integration and yaml tests to 8.19 build * add test to skip list * stop building on buildkite
1 parent 0b5d1fe commit b66ad43

8 files changed

Lines changed: 791 additions & 19 deletions

File tree

.buildkite/pipeline.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ steps:
44
- label: ":elasticsearch: :php: ES PHP ({{ matrix.php }}) Test Suite: {{ matrix.suite }}"
55
agents:
66
provider: "gcp"
7-
env:
8-
PHP_VERSION: "{{ matrix.php }}"
9-
TEST_SUITE: "{{ matrix.suite }}"
10-
STACK_VERSION: 8.19.10-SNAPSHOT
11-
matrix:
12-
setup:
13-
suite:
14-
- "free"
15-
- "platinum"
16-
php:
17-
- "8.4-cli"
18-
- "8.3-cli"
19-
- "8.2-cli"
20-
- "8.1-cli"
21-
- "8.0-cli"
22-
- "7.4-cli"
23-
command: ./.buildkite/run-tests
24-
artifact_paths: "*.xml"
7+
# env:
8+
# PHP_VERSION: "{{ matrix.php }}"
9+
# TEST_SUITE: "{{ matrix.suite }}"
10+
# STACK_VERSION: 8.19.10-SNAPSHOT
11+
# matrix:
12+
# setup:
13+
# suite:
14+
# - "free"
15+
# - "platinum"
16+
# php:
17+
# - "8.4-cli"
18+
# - "8.3-cli"
19+
# - "8.2-cli"
20+
# - "8.1-cli"
21+
# - "8.0-cli"
22+
# - "7.4-cli"
23+
# command: ./.buildkite/run-tests
24+
# artifact_paths: "*.xml"
25+
command: echo Not used
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PHP integration tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
matrix:
12+
php-version: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
13+
os: [ubuntu-latest]
14+
es-version: [8.19.10-SNAPSHOT]
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Use PHP ${{ matrix.php-version }}
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php-version }}
24+
extensions: yaml, zip, curl
25+
coverage: none
26+
env:
27+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Get composer cache directory
30+
id: composercache
31+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
32+
- name: Cache dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: ${{ steps.composercache.outputs.dir }}
36+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
37+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-
38+
39+
- name: Install dependencies
40+
run: |
41+
composer install --prefer-dist
42+
43+
- name: Run Elasticsearch using start-local
44+
run: |
45+
curl -fsSL https://elastic.co/start-local | sh -s -- -v ${{ matrix.es-version }} --esonly
46+
47+
- name: Integration tests
48+
run: |
49+
source elastic-start-local/.env
50+
ELASTICSEARCH_URL="http://elastic:${ES_LOCAL_PASSWORD}@localhost:9200" TEST_SUITE="free" composer run-script integration-test

.github/workflows/yaml_test.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: PHP YAML tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
matrix:
12+
php-version: [8.1, 8.2, 8.3, 8.4]
13+
os: [ubuntu-latest]
14+
es-version: [8.19.10-SNAPSHOT]
15+
test-suite: [stack]
16+
branch-client-tests: ["8.19"]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Use PHP ${{ matrix.php-version }}
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
extensions: yaml, zip, curl
27+
coverage: none
28+
env:
29+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Get composer cache directory
32+
id: composercache
33+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34+
- name: Cache dependencies
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ steps.composercache.outputs.dir }}
38+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}
39+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-
40+
41+
- name: Install dependencies
42+
run: |
43+
composer install --prefer-dist
44+
45+
- name: Run Elasticsearch using start-local
46+
run: |
47+
curl -fsSL https://elastic.co/start-local | sh -s -- -v ${{ matrix.es-version }} --esonly
48+
49+
- name: Build PHPUnit tests
50+
run: |
51+
git clone -b ${{ matrix.branch-client-tests }} https://github.com/elastic/elasticsearch-clients-tests.git tests/elasticsearch-clients-tests
52+
php tests/build_es_tests.php tests/elasticsearch-clients-tests/tests ${{ matrix.test-suite }} tests/Yaml
53+
54+
- name: YAML tests
55+
run: |
56+
source elastic-start-local/.env
57+
ELASTICSEARCH_URL="http://elastic:${ES_LOCAL_PASSWORD}@localhost:9200" TEST_SUITE="free" vendor/bin/phpunit -c "phpunit-yaml-${{ matrix.test-suite }}-tests.xml"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"nyholm/psr7": "^1.5",
2828
"php-http/mock-client": "^1.5",
2929
"symfony/http-client": "^5.0|^6.0|^7.0",
30-
"psr/http-factory" : "^1.0"
30+
"psr/http-factory" : "^1.0",
31+
"nette/php-generator": "^3.0"
3132
},
3233
"autoload": {
3334
"psr-4": {

phpunit-yaml-stack-tests.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" failOnRisky="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="false" cacheDirectory=".phpunit.cache">
3+
<php>
4+
<ini name="memory_limit" value="-1"/>
5+
</php>
6+
<testsuites>
7+
<testsuite name="YAML stack tests">
8+
<directory>tests/Yaml</directory>
9+
</testsuite>
10+
</testsuites>
11+
<groups>
12+
<include>
13+
<group>stack</group>
14+
</include>
15+
</groups>
16+
<logging>
17+
<junit outputFile="tests/yaml-test-junit.xml"/>
18+
</logging>
19+
<source>
20+
<include>
21+
<directory suffix=".php">src</directory>
22+
</include>
23+
</source>
24+
</phpunit>

0 commit comments

Comments
 (0)