Skip to content

Commit a8d78b5

Browse files
authored
Merge branch 'ISSUE-198' into ISSUE-198_handle_failure
2 parents 7254372 + c3e836b commit a8d78b5

20 files changed

+121
-89
lines changed
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
name: Integration Tests
2-
3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
10-
11-
jobs:
12-
tests:
13-
runs-on: ubuntu-latest
14-
env:
15-
CONNECTION: ${{ secrets.AURA_PRO }}
16-
name: "Running on all provided Aura instances"
17-
18-
steps:
19-
- uses: actions/checkout@v2
20-
- name: Cache Composer dependencies
21-
uses: actions/cache@v2
22-
with:
23-
path: /tmp/composer-cache
24-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
25-
- uses: php-actions/composer@v6
26-
with:
27-
progress: yes
28-
php_version: 8.1
29-
version: 2
30-
- name: clean database
31-
run: CONNECTION=$CONNECTION php tests/clean-database.php
32-
- uses: php-actions/phpunit@v3
33-
with:
34-
configuration: phpunit.xml.dist
35-
php_version: 8.1
36-
memory_limit: 1024M
37-
version: 10
38-
testsuite: Integration
39-
bootstrap: vendor/autoload.php
1+
#name: Integration Tests
2+
#
3+
#on:
4+
# push:
5+
# branches:
6+
# - main
7+
# pull_request:
8+
# branches:
9+
# - main
10+
#
11+
#jobs:
12+
# tests:
13+
# runs-on: ubuntu-latest
14+
# env:
15+
# CONNECTION: ${{ secrets.AURA_PRO }}
16+
# name: "Running on all provided Aura instances"
17+
#
18+
# steps:
19+
# - uses: actions/checkout@v2
20+
# - name: Cache Composer dependencies
21+
# uses: actions/cache@v2
22+
# with:
23+
# path: /tmp/composer-cache
24+
# key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
25+
# - uses: php-actions/composer@v6
26+
# with:
27+
# progress: yes
28+
# php_version: 8.1
29+
# version: 2
30+
# - name: clean database
31+
# run: CONNECTION=$CONNECTION php tests/clean-database.php
32+
# - uses: php-actions/phpunit@v3
33+
# with:
34+
# configuration: phpunit.xml.dist
35+
# php_version: 8.1
36+
# memory_limit: 1024M
37+
# version: 10
38+
# testsuite: Integration
39+
# bootstrap: vendor/autoload.php

.github/workflows/integration-test-cluster-neo4j-5.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
CONNECTION: neo4j://neo4j:testtest@localhost:7687
16-
name: "Running on PHP 8.1 with a Neo4j 5.10-enterprise cluster"
16+
name: "Running on PHP 8.1 with a Neo4j 5.20-enterprise cluster"
1717

1818
steps:
1919
- uses: actions/checkout@v2
@@ -38,7 +38,7 @@ jobs:
3838

3939
services:
4040
server1:
41-
image: neo4j:5.10-enterprise
41+
image: neo4j:5.20-enterprise
4242
ports:
4343
- 7687:7687
4444
- 7473:7473
@@ -59,7 +59,7 @@ jobs:
5959
--health-timeout "15s"
6060
--health-retries "5"
6161
server2:
62-
image: neo4j:5.10-enterprise
62+
image: neo4j:5.20-enterprise
6363
ports:
6464
- 8687:7687
6565
- 8473:7473
@@ -80,7 +80,7 @@ jobs:
8080
--health-timeout "15s"
8181
--health-retries "5"
8282
server3:
83-
image: neo4j:5.10-enterprise
83+
image: neo4j:5.20-enterprise
8484
ports:
8585
- 9474:7474
8686
- 9473:7473
@@ -101,7 +101,7 @@ jobs:
101101
--health-timeout "15s"
102102
--health-retries "5"
103103
read-server4:
104-
image: neo4j:5.10-enterprise
104+
image: neo4j:5.20-enterprise
105105
ports:
106106
- 10474:7474
107107
- 10473:7473

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.0-cli
1+
FROM php:8.1-cli
22
RUN apt-get update \
33
&& apt-get install -y \
44
libzip-dev \

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ services:
5252
- .env
5353
neo4j:
5454
<<: *common
55-
image: neo4j:5.10-community
55+
image: neo4j:5.20-community
5656
hostname: neo4j
5757
networks:
5858
- neo4j

src/Bolt/BoltConnection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@ public function commit(): void
243243
{
244244
$this->consumeResults();
245245

246-
if ($this->protocol()->serverState !== ServerState::TX_READY) {
247-
throw new Neo4jException([Neo4jError::fromMessageAndCode('Neo.ClientError.Request.Invalid', 'Message \'COMMIT\' cannot be handled by a session which isn\'t in the TX_READY state.')]);
248-
}
249-
250246
$response = $this->protocol()
251247
->commit()
252248
->getResponse();
@@ -306,7 +302,7 @@ public function pull(?int $qid, ?int $fetchSize): array
306302
public function __destruct()
307303
{
308304
try {
309-
if ($this->boltProtocol->serverState === ServerState::FAILED && $this->isOpen()) {
305+
if ($this->isOpen()) {
310306
if ($this->protocol()->serverState === ServerState::STREAMING || $this->protocol()->serverState === ServerState::TX_STREAMING) {
311307
$this->consumeResults();
312308
}

src/Neo4j/Neo4jConnectionPool.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,20 @@ public function acquire(SessionConfiguration $config): Generator
117117
$key = $this->createKey($this->data, $config);
118118

119119
/** @var RoutingTable|null */
120-
$table = $this->cache->get($key, null);
120+
$table = $this->cache->get($key);
121121
$triedAddresses = [];
122122

123123
$latestError = null;
124124

125125
if ($table == null) {
126-
$addresses = $this->resolver->getAddresses((string) $this->data->getUri());
126+
$addresses = (function () {
127+
yield gethostbyname($this->data->getUri()->getHost());
128+
yield from $this->resolver->getAddresses($this->data->getUri()->getHost());
129+
})();
127130
foreach ($addresses as $address) {
128131
$triedAddresses[] = $address;
129-
$pool = $this->createOrGetPool(Uri::create($address));
132+
133+
$pool = $this->createOrGetPool($this->data->getUri()->withHost($address));
130134
try {
131135
/** @var BoltConnection $connection */
132136
$connection = GeneratorHelper::getReturnFromGenerator($pool->acquire($config));

tests/Integration/EnvironmentAwareIntegrationTest.php renamed to tests/EnvironmentAwareIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* file that was distributed with this source code.
1212
*/
1313

14-
namespace Laudis\Neo4j\Tests\Integration;
14+
namespace Laudis\Neo4j\Tests;
1515

1616
use function is_string;
1717

tests/Integration/BasicDriverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Laudis\Neo4j\Basic\Driver;
1818
use Laudis\Neo4j\Bolt\BoltDriver;
1919
use Laudis\Neo4j\Exception\Neo4jException;
20+
use Laudis\Neo4j\Tests\EnvironmentAwareIntegrationTest;
2021
use Laudis\Neo4j\Types\CypherMap;
2122

2223
final class BasicDriverTest extends EnvironmentAwareIntegrationTest

tests/Integration/BoltDriverIntegrationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Laudis\Neo4j\Bolt\BoltDriver;
1919
use Laudis\Neo4j\Databags\SummarizedResult;
2020
use Laudis\Neo4j\Neo4j\Neo4jDriver;
21+
use Laudis\Neo4j\Tests\EnvironmentAwareIntegrationTest;
2122
use Throwable;
2223

2324
final class BoltDriverIntegrationTest extends EnvironmentAwareIntegrationTest

tests/Integration/BoltResultIntegrationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Laudis\Neo4j\Databags\SessionConfiguration;
2424
use Laudis\Neo4j\Databags\SslConfiguration;
2525
use Laudis\Neo4j\Enum\SslMode;
26+
use Laudis\Neo4j\Tests\EnvironmentAwareIntegrationTest;
2627

2728
final class BoltResultIntegrationTest extends EnvironmentAwareIntegrationTest
2829
{

0 commit comments

Comments
 (0)