Add group for cache tests
authorPhilipp Holzer <admin+github@philipp.info>
Mon, 23 Sep 2019 12:31:13 +0000 (14:31 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Mon, 30 Sep 2019 12:03:13 +0000 (14:03 +0200)
autotest.sh
tests/src/Core/Cache/APCuCacheTest.php
tests/src/Core/Cache/MemcacheCacheTest.php
tests/src/Core/Cache/MemcachedCacheTest.php
tests/src/Core/Cache/RedisCacheTest.php
tests/src/Core/Lock/APCuCacheLockTest.php
tests/src/Core/Lock/MemcacheCacheLockTest.php
tests/src/Core/Lock/MemcachedCacheLockTest.php
tests/src/Core/Lock/RedisCacheLockTest.php

index 796572d..b160950 100755 (executable)
@@ -134,13 +134,31 @@ function execute_tests {
       echo "No coverage"
     fi
 
+    # per default, there is no cache installed
+    GROUP='--exclude-group=REDIS,MEMCACHE,MEMCACHED,APCU'
+    if [ "$TEST_SELECTION" == "REDIS" ]; then
+      GROUP="--group REDIS"
+    fi
+    if [ "$TEST_SELECTION" == "MEMCACHE" ]; then
+      GROUP="--group MEMCACHE"
+    fi
+    if [ "$TEST_SELECTION" == "MEMCACHED" ]; then
+      GROUP="--group MEMCACHED"
+    fi
+    if [ "$TEST_SELECTION" == "APCU" ]; then
+      GROUP="--group APCU"
+    fi
+    if [ "$TEST_SELECTION" == "NODB" ]; then
+      GROUP="--exclude-group=DB,SLOWDB"
+    fi
+
     INPUT="$BASEDIR/tests"
     if [ -n "$1" ]; then
       INPUT="$INPUT/$1"
     fi
 
-    echo "${PHPUNIT[@]}" --configuration tests/phpunit.xml $COVER --log-junit "autotest-results.xml" "$INPUT" "$2"
-    "${PHPUNIT[@]}" --configuration tests/phpunit.xml $COVER --log-junit "autotest-results.xml" "$INPUT" "$2"
+    echo "${PHPUNIT[@]}" --configuration tests/phpunit.xml "$GROUP" "$COVER" --log-junit "autotest-results.xml" "$INPUT" "$2"
+    "${PHPUNIT[@]}" --configuration tests/phpunit.xml "$GROUP" "$COVER" --log-junit "autotest-results.xml" "$INPUT" "$2"
     RESULT=$?
 
     if [ -n "$DOCKER_CONTAINER_ID" ]; then
index 1b90be5..dfb81d9 100644 (file)
@@ -4,6 +4,9 @@ namespace Friendica\Test\src\Core\Cache;
 
 use Friendica\Core\Cache\APCuCache;
 
+/**
+ * @group APCU
+ */
 class APCuCacheTest extends MemoryCacheTest
 {
        protected function setUp()
index 8abf169..4e3a806 100644 (file)
@@ -7,6 +7,7 @@ use Friendica\Core\Config\Configuration;
 
 /**
  * @requires extension memcache
+ * @group MEMCACHE
  */
 class MemcacheCacheTest extends MemoryCacheTest
 {
index c8c65c9..058a784 100644 (file)
@@ -9,6 +9,7 @@ use Psr\Log\NullLogger;
 
 /**
  * @requires extension memcached
+ * @group MEMCACHED
  */
 class MemcachedCacheTest extends MemoryCacheTest
 {
index cddefe3..75891cd 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\Core\Config\Configuration;
 
 /**
  * @requires extension redis
+ * @group REDIS
  */
 class RedisCacheTest extends MemoryCacheTest
 {
index 3fbb360..c243717 100644 (file)
@@ -5,6 +5,9 @@ namespace Friendica\Test\src\Core\Lock;
 use Friendica\Core\Cache\APCuCache;
 use Friendica\Core\Lock\CacheLock;
 
+/**
+ * @group APCU
+ */
 class APCuCacheLockTest extends LockTest
 {
        protected function setUp()
index 4e7dd30..cebe246 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Core\Lock\CacheLock;
 
 /**
  * @requires extension Memcache
+ * @group MEMCACHE
  */
 class MemcacheCacheLockTest extends LockTest
 {
index 2249b88..8538723 100644 (file)
@@ -10,6 +10,7 @@ use Psr\Log\NullLogger;
 
 /**
  * @requires extension memcached
+ * @group MEMCACHED
  */
 class MemcachedCacheLockTest extends LockTest
 {
index 5cecd8f..95f7206 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Core\Lock\CacheLock;
 
 /**
  * @requires extension redis
+ * @group REDIS
  */
 class RedisCacheLockTest extends LockTest
 {