diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index f69098cde7b0122ee48430bf1cd04720e5bad409..90d9f0a8567ebcf5c0535ae481f957d887ce7f6b 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -30,6 +30,9 @@ use OCP\Share\IShare; use OCP\Share\IManager; use OCP\Files\Mount\IMountPoint; +/** + * @group DB + */ class MountProviderTest extends \Test\TestCase { /** @var MountProvider */ diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 31549c93cb2756d6b02baea6fd02e7caf75ea006..7d9771e6394ddcf3b4bed3852452678e3d57f48e 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1980,7 +1980,7 @@ class View { $mount = $this->getMountForLock($absolutePath, $lockMountPoint); if ($mount) { $storage = $mount->getStorage(); - if ($storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + if ($storage && $storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { $storage->releaseLock( $mount->getInternalPath($absolutePath), $type, diff --git a/tests/objectstore/start-swift-ceph.sh b/tests/objectstore/start-swift-ceph.sh index 089aab6a6487a12afd153b71a1608cf5aa79b82e..bbf483c28970b16df7e3dd9a48a7f5b9878d7db6 100755 --- a/tests/objectstore/start-swift-ceph.sh +++ b/tests/objectstore/start-swift-ceph.sh @@ -30,6 +30,7 @@ thisFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # create readiness notification socket notify_sock=$(readlink -f "$thisFolder"/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock) +rm -f "$notify_sock" # in case an unfinished test left one behind mkfifo "$notify_sock" port=5034 @@ -67,7 +68,13 @@ if [[ $ready != 'READY=1' ]]; then docker logs $container exit 1 fi -sleep 1 +if ! "$thisFolder"/wait-for-connection ${host} 80 600; then + echo "[ERROR] Waited 600 seconds, no response" >&2 + docker logs $container + exit 1 +fi +echo "Waiting another 15 seconds" +sleep 15 cat > $thisFolder/swift.config.php <<DELIM <?php @@ -101,5 +108,7 @@ if [ -n "$DEBUG" ]; then cat $thisFolder/swift.config.php echo "### contents of $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift" cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift + echo "### docker logs" + docker logs $container echo "############## DEBUG info end ###########" fi diff --git a/tests/objectstore/wait-for-connection b/tests/objectstore/wait-for-connection new file mode 100755 index 0000000000000000000000000000000000000000..2c480fb733e610790aff3a2e9a8bc93ed56dd805 --- /dev/null +++ b/tests/objectstore/wait-for-connection @@ -0,0 +1,45 @@ +#!/usr/bin/php +<?php + +$timeout = 60; + +switch ($argc) { +case 4: + $timeout = (float)$argv[3]; +case 3: + $host = $argv[1]; + $port = (int)$argv[2]; + break; +default: + fwrite(STDERR, 'Usage: '.$argv[0].' host port [timeout]'."\n"); + exit(2); +} + +if ($timeout < 0) { + fwrite(STDERR, 'Timeout must be greater than zero'."\n"); + exit(2); +} +if ($port < 1) { + fwrite(STDERR, 'Port must be an integer greater than zero'."\n"); + exit(2); +} + +$socketTimeout = (float)ini_get('default_socket_timeout'); +if ($socketTimeout > $timeout) { + $socketTimeout = $timeout; +} + +$stopTime = time() + $timeout; +do { + $sock = @fsockopen($host, $port, $errno, $errstr, $socketTimeout); + if ($sock !== false) { + fclose($sock); + fwrite(STDOUT, "\n"); + exit(0); + } + sleep(1); + fwrite(STDOUT, '.'); +} while (time() < $stopTime); + +fwrite(STDOUT, "\n"); +exit(1);