Skip to content

Commit bae9e7a

Browse files
minor symfony#53464 [Messenger] Improve Redis integration tests (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Improve Redis integration tests | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT This kind of failure can happen when cleaning Redis in the `finally` clause: ![image](https://github.com/symfony/symfony/assets/2144837/92053c64-3a41-4235-9105-7d96378cf925) Unlinking will trigger the cleaning in another process, thus it won't make the test fail if a problem is triggered. I think this is desired so we don't have false negatives. Commits ------- 84a0245 [Messenger] Improve Redis integration tests
2 parents d7ba8ff + 84a0245 commit bae9e7a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function testLazy()
257257
], $message['data']);
258258
$connection->reject($message['id']);
259259
} finally {
260-
$redis->del('messenger-lazy');
260+
$redis->unlink('messenger-lazy');
261261
}
262262
}
263263

@@ -295,14 +295,13 @@ public function testJsonError()
295295
} catch (TransportException $e) {
296296
$this->assertSame('Malformed UTF-8 characters, possibly incorrectly encoded', $e->getMessage());
297297
} finally {
298-
$redis->del('messenger-json-error');
298+
$redis->unlink('messenger-json-error');
299299
}
300300
}
301301

302302
public function testGetNonBlocking()
303303
{
304304
$redis = new \Redis();
305-
306305
$connection = Connection::fromDsn('redis://localhost/messenger-getnonblocking', ['delete_after_ack' => true], $redis);
307306

308307
try {
@@ -311,7 +310,7 @@ public function testGetNonBlocking()
311310
$this->assertNotEmpty($message = $connection->get());
312311
$connection->reject($message['id']);
313312
} finally {
314-
$redis->del('messenger-getnonblocking');
313+
$redis->unlink('messenger-getnonblocking');
315314
}
316315
}
317316

@@ -330,7 +329,7 @@ public function testGetAfterReject()
330329
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget', ['delete_after_ack' => true]);
331330
$this->assertNotNull($connection->get());
332331
} finally {
333-
$redis->del('messenger-rejectthenget');
332+
$redis->unlink('messenger-rejectthenget');
334333
}
335334
}
336335

0 commit comments

Comments
 (0)