Skip to content

Commit f14e6af

Browse files
committed
Added integration tests + fixed getHost for free and platinum
1 parent e404235 commit f14e6af

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,22 @@ jobs:
4646
4747
- name: Unit tests
4848
run: |
49-
vendor/bin/phpunit -c phpunit.xml.dist
49+
composer run-script test
5050
env:
5151
TEST_SUITE: free
52-
52+
53+
- name: Configure sysctl limits
54+
run: |
55+
sudo swapoff -a
56+
sudo sysctl -w vm.swappiness=1
57+
sudo sysctl -w fs.file-max=262144
58+
sudo sysctl -w vm.max_map_count=262144
59+
60+
- name: Runs Elasticsearch ${{ matrix.es-version }}
61+
uses: elastic/elastic-github-actions/elasticsearch@master
62+
with:
63+
stack-version: ${{ matrix.es-version }}
64+
65+
- name: Integration tests
66+
run: |
67+
composer run-script integration-test

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
},
4141
"scripts": {
4242
"test" : [
43-
"vendor/bin/phpunit"
43+
"vendor/bin/phpunit --testdox"
4444
],
4545
"integration-test" : [
46-
"vendor/bin/phpunit -c phpunit-integration-tests.xml"
46+
"vendor/bin/phpunit --testdox -c phpunit-integration-tests.xml"
4747
],
4848
"phpstan": [
4949
"phpstan analyse src --level 2 --no-progress"

src/ClientBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ class ClientBuilder
8787

8888
/**
8989
* SSL certificate
90-
* @param array [$cert, $password] $cert is the name of a file containing a PEM formatted certificate,
90+
* @var array [$cert, $password] $cert is the name of a file containing a PEM formatted certificate,
9191
* $password if the certificate requires a password
9292
*/
9393
private array $sslCert;
9494

9595
/**
9696
* SSL key
97-
* @param array [$key, $password] $key is the name of a file containing a private SSL key,
97+
* @var array [$key, $password] $key is the name of a file containing a private SSL key,
9898
* $password if the private key requires a password
9999
*/
100100
private array $sslKey;

tests/Utility.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public static function getHost(): ?string
6262
if (false !== $url) {
6363
return $url;
6464
}
65+
if (getenv('TEST_SUITE') === 'free') {
66+
return 'http://localhost:9200';
67+
}
6568
return 'https://localhost:9200';
6669
}
6770

@@ -70,6 +73,11 @@ public static function getHost(): ?string
7073
*/
7174
public static function getClient(): Client
7275
{
76+
if (getenv('TEST_SUITE') === 'free') {
77+
return ClientBuilder::create()
78+
->setHosts([self::getHost()])
79+
->build();
80+
}
7381
return ClientBuilder::create()
7482
->setHosts([self::getHost()])
7583
->setBasicAuthentication('elastic', 'changeme')

0 commit comments

Comments
 (0)