Skip to content

Commit 9e0377f

Browse files
Merge pull request #53425 from nextcloud/backport/53378/stable31
[stable31] test: run all files_external tests for S3
2 parents 65ccf75 + 9fa9ffd commit 9e0377f

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

.github/workflows/files-external-s3.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444

4545
strategy:
4646
matrix:
47-
php-versions: ['8.1', '8.2', '8.3', '8.4']
47+
php-versions: ['8.1', '8.2', '8.4']
4848
include:
49-
- php-versions: '8.2'
49+
- php-versions: '8.3'
5050
coverage: ${{ github.event_name != 'pull_request' }}
5151

5252
name: php${{ matrix.php-versions }}-s3
@@ -87,18 +87,19 @@ jobs:
8787
composer install
8888
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
8989
./occ app:enable --force files_external
90-
echo "<?php return ['run' => true, 'secret' => 'actually-not-secret', 'passwordsalt' => 'actually-not-secret', 'hostname' => 'localhost','key' => '$OBJECT_STORE_KEY','secret' => '$OBJECT_STORE_SECRET', 'bucket' => 'bucket', 'port' => 9000, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/files_external/tests/config.amazons3.php
90+
echo "<?php return ['run' => true, 'minio' => true, 'secret' => 'actually-not-secret', 'passwordsalt' => 'actually-not-secret', 'hostname' => 'localhost','key' => '$OBJECT_STORE_KEY','secret' => '$OBJECT_STORE_SECRET', 'bucket' => 'bucket', 'port' => 9000, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/files_external/tests/config.amazons3.php
9191
9292
- name: Wait for S3
9393
run: |
94-
sleep 10
9594
curl -f -m 1 --retry-connrefused --retry 10 --retry-delay 10 http://localhost:9000/minio/health/ready
9695
9796
- name: PHPUnit
98-
run: composer run test:files_external -- \
99-
apps/files_external/tests/Storage/Amazons3Test.php \
100-
apps/files_external/tests/Storage/VersionedAmazonS3Test.php \
101-
${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
97+
run: |
98+
composer run test:files_external -- \
99+
--group S3 \
100+
--log-junit junit.xml \
101+
apps/files_external/tests/Storage \
102+
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
102103
103104
- name: Upload code coverage
104105
if: ${{ !cancelled() && matrix.coverage }}
@@ -121,7 +122,7 @@ jobs:
121122

122123
strategy:
123124
matrix:
124-
php-versions: ['8.1', '8.2', '8.3']
125+
php-versions: ['8.1', '8.2', '8.4']
125126
include:
126127
- php-versions: '8.3'
127128
coverage: true
@@ -133,7 +134,7 @@ jobs:
133134
env:
134135
SERVICES: s3
135136
DEBUG: 1
136-
image: localstack/localstack@sha256:b52c16663c70b7234f217cb993a339b46686e30a1a5d9279cb5feeb2202f837c # v4.4.0
137+
image: localstack/localstack@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d # v4.5.0
137138
ports:
138139
- "4566:4566"
139140

@@ -160,13 +161,15 @@ jobs:
160161
composer install
161162
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
162163
./occ app:enable --force files_external
163-
echo "<?php return ['run' => true,'hostname' => 'localhost','key' => 'ignored','secret' => 'ignored', 'bucket' => 'bucket', 'port' => 4566, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/files_external/tests/config.amazons3.php
164+
echo "<?php return ['run' => true, 'localstack' => true, 'hostname' => 'localhost','key' => 'ignored','secret' => 'ignored', 'bucket' => 'bucket', 'port' => 4566, 'use_ssl' => false, 'autocreate' => true, 'use_path_style' => true];" > apps/files_external/tests/config.amazons3.php
164165
165166
- name: PHPUnit
166-
run: composer run test:files_external -- \
167-
apps/files_external/tests/Storage/Amazons3Test.php \
168-
apps/files_external/tests/Storage/VersionedAmazonS3Test.php \
169-
${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
167+
run: |
168+
composer run test:files_external -- \
169+
--group S3 \
170+
--log-junit junit.xml \
171+
apps/files_external/tests/Storage \
172+
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
170173
171174
- name: Upload code coverage
172175
if: ${{ !cancelled() && matrix.coverage }}

apps/files_external/tests/Storage/Amazons3MultiPartTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Class Amazons3Test
1212
*
1313
* @group DB
14+
* @group S3
1415
*
1516
* @package OCA\Files_External\Tests\Storage
1617
*/
@@ -23,7 +24,7 @@ protected function setUp(): void {
2324
parent::setUp();
2425

2526
$this->config = include('files_external/tests/config.amazons3.php');
26-
if (! is_array($this->config) or ! $this->config['run']) {
27+
if (!is_array($this->config) || !$this->config['run']) {
2728
$this->markTestSkipped('AmazonS3 backend not configured');
2829
}
2930
$this->instance = new AmazonS3($this->config + [
@@ -43,8 +44,4 @@ protected function tearDown(): void {
4344
public function testStat(): void {
4445
$this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
4546
}
46-
47-
public function testHashInFileName(): void {
48-
$this->markTestSkipped('Localstack has a bug with hashes in filename');
49-
}
5047
}

apps/files_external/tests/Storage/Amazons3Test.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@
1212
* Class Amazons3Test
1313
*
1414
* @group DB
15+
* @group S3
1516
*
1617
* @package OCA\Files_External\Tests\Storage
1718
*/
1819
class Amazons3Test extends \Test\Files\Storage\Storage {
19-
private $config;
20+
protected $config;
2021
/** @var AmazonS3 */
2122
protected $instance;
2223

2324
protected function setUp(): void {
2425
parent::setUp();
2526

2627
$this->config = include('files_external/tests/config.amazons3.php');
27-
if (! is_array($this->config) or ! $this->config['run']) {
28+
if (!is_array($this->config) || !$this->config['run']) {
2829
$this->markTestSkipped('AmazonS3 backend not configured');
2930
}
3031
$this->instance = new AmazonS3($this->config);
@@ -41,8 +42,4 @@ protected function tearDown(): void {
4142
public function testStat(): void {
4243
$this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
4344
}
44-
45-
public function testHashInFileName(): void {
46-
$this->markTestSkipped('Localstack has a bug with hashes in filename');
47-
}
4845
}

apps/files_external/tests/Storage/VersionedAmazonS3Test.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* @group DB
13+
* @group S3
1314
*/
1415
class VersionedAmazonS3Test extends Amazons3Test {
1516
protected function setUp(): void {
@@ -25,4 +26,12 @@ protected function setUp(): void {
2526
$this->markTestSkipped("s3 backend doesn't seem to support versioning");
2627
}
2728
}
29+
30+
public function testCopyOverWriteDirectory(): void {
31+
if (isset($this->config['minio'])) {
32+
$this->markTestSkipped('MinIO has a bug with batch deletion on versioned storages, see https://github.com/minio/minio/issues/21366');
33+
}
34+
35+
parent::testCopyOverWriteDirectory();
36+
}
2837
}

0 commit comments

Comments
 (0)