aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-11-02 22:05:57 +0100
committerGitHub <noreply@github.com>2016-11-02 22:05:57 +0100
commitc1feae1684934bb52b1edaa67d33d01b377b875a (patch)
tree1a278d6b1f0a0204d6ac1b4cd17034c4bbb6d8d6 /tests
parentb4cf559707b48bca6d52194dec87d84a5597c317 (diff)
parent049bcae29ebf6106b33dd44f3be30e2a8486cd98 (diff)
downloadnextcloud-server-c1feae1684934bb52b1edaa67d33d01b377b875a.tar.gz
nextcloud-server-c1feae1684934bb52b1edaa67d33d01b377b875a.zip
Merge pull request #1981 from nextcloud/multibucket-num-buckets
Allow setting a maximun number of buckets for multibucket
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Mount/ObjectHomeMountProviderTest.php8
-rw-r--r--tests/lib/Files/ObjectStore/MapperTest.php14
2 files changed, 13 insertions, 9 deletions
diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
index 0af90991d60..9aa0143b4a7 100644
--- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
@@ -80,7 +80,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->equalTo('uid'),
$this->equalTo('homeobjectstore'),
$this->equalTo('bucket'),
- $this->equalTo('987'),
+ $this->equalTo('49'),
$this->equalTo(null)
);
@@ -94,7 +94,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertArrayHasKey('objectstore', $config['arguments']);
$this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
$this->assertArrayHasKey('bucket', $config['arguments']);
- $this->assertEquals('987', $config['arguments']['bucket']);
+ $this->assertEquals('49', $config['arguments']['bucket']);
}
public function testMultiBucketWithPrefix() {
@@ -127,7 +127,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->equalTo('uid'),
$this->equalTo('homeobjectstore'),
$this->equalTo('bucket'),
- $this->equalTo('myBucketPrefix987'),
+ $this->equalTo('myBucketPrefix49'),
$this->equalTo(null)
);
@@ -141,7 +141,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertArrayHasKey('objectstore', $config['arguments']);
$this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
$this->assertArrayHasKey('bucket', $config['arguments']);
- $this->assertEquals('myBucketPrefix987', $config['arguments']['bucket']);
+ $this->assertEquals('myBucketPrefix49', $config['arguments']['bucket']);
}
public function testMultiBucketBucketAlreadySet() {
diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php
index 18bdcdfd005..19451622fa3 100644
--- a/tests/lib/Files/ObjectStore/MapperTest.php
+++ b/tests/lib/Files/ObjectStore/MapperTest.php
@@ -28,24 +28,28 @@ class MapperTest extends \Test\TestCase {
public function dataGetBucket() {
return [
- ['user', substr(md5('user'), 0, 3)],
- ['USER', substr(md5('USER'), 0, 3)],
- ['bc0e8b52-a66c-1035-90c6-d9663bda9e3f', substr(md5('bc0e8b52-a66c-1035-90c6-d9663bda9e3f'), 0, 3)],
+ ['user', 64, '17'],
+ ['USER', 64, '0'],
+ ['bc0e8b52-a66c-1035-90c6-d9663bda9e3f', 64, '56'],
+ ['user', 8, '1'],
+ ['user', 2, '1'],
+ ['USER', 2, '0'],
];
}
/**
* @dataProvider dataGetBucket
* @param string $username
+ * @param int $numBuckets
* @param string $expectedBucket
*/
- public function testGetBucket($username, $expectedBucket) {
+ public function testGetBucket($username, $numBuckets, $expectedBucket) {
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn($username);
$mapper = new Mapper($user);
- $this->assertSame($expectedBucket, $mapper->getBucket());
+ $this->assertSame($expectedBucket, $mapper->getBucket($numBuckets));
}
}