summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-03-08 13:36:11 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-03-08 13:38:39 +0100
commit060b637b70ed44ac09e400a435ca066c514ef09a (patch)
tree6240481ae2dd87c555c97d19b9c3340c5d56c5e3 /tests
parent49c7799496344ad1b5efa5295dad60c8595f4bf2 (diff)
downloadnextcloud-server-060b637b70ed44ac09e400a435ca066c514ef09a.tar.gz
nextcloud-server-060b637b70ed44ac09e400a435ca066c514ef09a.zip
Show a setup warning in case S3 object storage is used as primary storage
* checks for at least 50 GB of free space Signed-off-by: Morris Jobke <hey@morrisjobke.de>
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'));
+ }
}