Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-03-08 20:03:49 +0300
committerGitHub <noreply@github.com>2019-03-08 20:03:49 +0300
commitd40b21ac815b8088a5d0b51a6d48b39ed754631a (patch)
tree2913953835e4d6cc4a9c985f48391eb999132501 /tests
parent8996b9efbf61db703c73d4cfd872a83fe9d105e6 (diff)
parent060b637b70ed44ac09e400a435ca066c514ef09a (diff)
Merge pull request #14603 from nextcloud/fix/noid/add-setup-check-for-s3-temp-path
Show a setup warning in case S3 object storage is used as primary storage
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index dd13b29697d..521cadfcd3b 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -160,6 +160,7 @@ class CheckSetupControllerTest extends TestCase {
'hasRecommendedPHPModules',
'hasBigIntConversionPendingColumns',
'isMysqlUsedWithoutUTF8MB4',
+ 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed',
])->getMock();
}
@@ -526,6 +527,11 @@ class CheckSetupControllerTest extends TestCase {
->method('isMysqlUsedWithoutUTF8MB4')
->willReturn(false);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed')
+ ->willReturn(true);
+
$expected = new DataResponse(
[
'isGetenvServerWorking' => true,
@@ -570,6 +576,7 @@ class CheckSetupControllerTest extends TestCase {
'recommendedPHPModules' => [],
'pendingBigIntConversionColumns' => [],
'isMysqlUsedWithoutUTF8MB4' => false,
+ 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true,
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
@@ -1400,4 +1407,53 @@ Array
$this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isMysqlUsedWithoutUTF8MB4'));
}
+
+ public function dataForIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed() {
+ return [
+ ['singlebucket', 'OC\\Files\\ObjectStore\\Swift', true],
+ ['multibucket', 'OC\\Files\\ObjectStore\\Swift', true],
+ ['singlebucket', 'OC\\Files\\ObjectStore\\Custom', true],
+ ['multibucket', 'OC\Files\\ObjectStore\\Custom', true],
+ ['singlebucket', 'OC\Files\ObjectStore\Swift', true],
+ ['multibucket', 'OC\Files\ObjectStore\Swift', true],
+ ['singlebucket', 'OC\Files\ObjectStore\Custom', true],
+ ['multibucket', 'OC\Files\ObjectStore\Custom', true],
+ ];
+ }
+
+ /**
+ * @dataProvider dataForIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed
+ */
+ public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $mode, string $className, bool $expected) {
+ $this->config->method('getSystemValue')
+ ->will($this->returnCallback(function($key, $default) use ($mode, $className) {
+ if ($key === 'objectstore' && $mode === 'singlebucket') {
+ return ['class' => $className];
+ }
+ if ($key === 'objectstore_multibucket' && $mode === 'multibucket') {
+ return ['class' => $className];
+ }
+ return $default;
+ }));
+
+ $checkSetupController = new CheckSetupController(
+ 'settings',
+ $this->request,
+ $this->config,
+ $this->clientService,
+ $this->urlGenerator,
+ $this->util,
+ $this->l10n,
+ $this->checker,
+ $this->logger,
+ $this->dispatcher,
+ $this->db,
+ $this->lockingProvider,
+ $this->dateTimeFormatter,
+ $this->memoryInfo,
+ $this->secureRandom
+ );
+
+ $this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed'));
+ }
}