Skip to content

Commit e782c91

Browse files
committed
testing ES 9
1 parent ca5410d commit e782c91

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
matrix:
1717
php: [ 8.3, 8.4 ]
1818
laravel: [ 13.*, 12.*, 11.* ]
19+
elasticsearch: [ 8.18.0, 9.5.1 ]
1920
include:
2021
- laravel: 13.*
2122
testbench: 11.*
@@ -24,7 +25,7 @@ jobs:
2425
- laravel: 11.*
2526
testbench: 9.*
2627

27-
name: P${{ matrix.php }} - L${{ matrix.laravel }}
28+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ES${{ matrix.elasticsearch }}
2829

2930
env:
3031
BROADCAST_DRIVER: log
@@ -40,7 +41,9 @@ jobs:
4041

4142
services:
4243
elasticsearch:
43-
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0
44+
# Always pinned, never a floating tag. A silent major bump on the
45+
# server side should fail a deliberate matrix row, not every job at once.
46+
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch }}
4447
env:
4548
discovery.type: single-node
4649
xpack.security.enabled: 'false'

tests/TestCase.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ protected function getPackageProviders($app): array
2020

2121
protected function getEnvironmentSetUp($app): void
2222
{
23+
$host = env('ELASTICSEARCH_HOST', 'http://localhost:'.env('ELASTICSEARCH_PORT', '9200'));
24+
2325
$app['config']->set('database.default', 'elasticsearch');
2426

2527
$app['config']->set('database.connections.sqlite', [
@@ -33,15 +35,15 @@ protected function getEnvironmentSetUp($app): void
3335
$app['config']->set('database.connections.elasticsearch', [
3436
'driver' => 'elasticsearch',
3537
'auth_type' => 'http',
36-
'hosts' => ['http://localhost:9200'],
38+
'hosts' => [$host],
3739
'options' => [
3840
'logging' => true,
3941
],
4042
]);
4143
$app['config']->set('database.connections.elasticsearch_with_default_limit', [
4244
'driver' => 'elasticsearch',
4345
'auth_type' => 'http',
44-
'hosts' => ['http://localhost:9200'],
46+
'hosts' => [$host],
4547
'options' => [
4648
'default_limit' => 4,
4749
'logging' => true,
@@ -51,7 +53,7 @@ protected function getEnvironmentSetUp($app): void
5153
$app['config']->set('database.connections.elasticsearch_unsafe', [
5254
'driver' => 'elasticsearch',
5355
'auth_type' => 'http',
54-
'hosts' => ['http://localhost:9200'],
56+
'hosts' => [$host],
5557
'options' => [
5658
'bypass_map_validation' => true,
5759
'insert_chunk_size' => 10000,
@@ -62,7 +64,7 @@ protected function getEnvironmentSetUp($app): void
6264
$app['config']->set('database.connections.elasticsearch_with_default_track_total_hits', [
6365
'driver' => 'elasticsearch',
6466
'auth_type' => 'http',
65-
'hosts' => ['http://localhost:9200'],
67+
'hosts' => [$host],
6668
'options' => [
6769
'track_total_hits' => true,
6870
'logging' => true,

0 commit comments

Comments
 (0)