Skip to content

Commit 2ea9e80

Browse files
committed
minor #36647 Execute docker dependent tests with github actions (jakzal)
This PR was merged into the 4.4 branch. Discussion ---------- Execute docker dependent tests with github actions | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fixes #36427 | License | MIT | Doc PR | - * redis, memcached, rabbitmq and vulcain dependent tests moved to the github action * run on PHP 7.1 and 7.4 only * use the `integration` group for all tests that depend on docker services * do not exclude the `integration` group on Travis, but make sure tests that depend on docker services are skipped properly [<img width="1222" alt="image" src="https://user-images.githubusercontent.com/190447/80806323-48339100-8bb2-11ea-95cd-5ce773c74ce6.png">](https://github.com/jakzal/symfony/runs/636461875?check_suite_focus=true) Commits ------- d710c1b654 Execute docker dependent tests with github actions
2 parents 878e351 + 226c961 commit 2ea9e80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Tests/Functional/CachePoolsTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ public function testCachePools()
2626

2727
/**
2828
* @requires extension redis
29+
* @group integration
2930
*/
3031
public function testRedisCachePools()
3132
{
33+
$this->skipIfRedisUnavailable();
34+
3235
try {
3336
$this->doTestCachePools(['root_config' => 'redis_config.yml', 'environment' => 'redis_cache'], RedisAdapter::class);
3437
} catch (\PHPUnit\Framework\Error\Warning $e) {
@@ -51,9 +54,12 @@ public function testRedisCachePools()
5154

5255
/**
5356
* @requires extension redis
57+
* @group integration
5458
*/
5559
public function testRedisCustomCachePools()
5660
{
61+
$this->skipIfRedisUnavailable();
62+
5763
try {
5864
$this->doTestCachePools(['root_config' => 'redis_custom_config.yml', 'environment' => 'custom_redis_cache'], RedisAdapter::class);
5965
} catch (\PHPUnit\Framework\Error\Warning $e) {
@@ -121,4 +127,13 @@ protected static function createKernel(array $options = []): KernelInterface
121127
{
122128
return parent::createKernel(['test_case' => 'CachePools'] + $options);
123129
}
130+
131+
private function skipIfRedisUnavailable()
132+
{
133+
try {
134+
(new \Redis())->connect(getenv('REDIS_HOST'));
135+
} catch (\Exception $e) {
136+
self::markTestSkipped($e->getMessage());
137+
}
138+
}
124139
}

0 commit comments

Comments
 (0)