Skip to content

Commit 6d8b263

Browse files
authored
Merge pull request nextcloud#53378 from nextcloud/fix/files-external-workflow
test: run all files_external tests for S3
2 parents 1474fa3 + 5f200c7 commit 6d8b263

4 files changed

Lines changed: 37 additions & 27 deletions

File tree

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
php-versions: ['8.1', '8.2', '8.3', '8.4']
48+
php-versions: ['8.1', '8.2', '8.4']
4949
include:
50-
- php-versions: '8.2'
50+
- php-versions: '8.3'
5151
coverage: ${{ github.event_name != 'pull_request' }}
5252

5353
name: php${{ matrix.php-versions }}-s3-minio
@@ -88,18 +88,19 @@ jobs:
8888
composer install
8989
./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
9090
./occ app:enable --force files_external
91-
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
91+
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
9292
9393
- name: Wait for S3
9494
run: |
95-
sleep 10
9695
curl -f -m 1 --retry-connrefused --retry 10 --retry-delay 10 http://localhost:9000/minio/health/ready
9796
9897
- name: PHPUnit
99-
run: composer run test:files_external -- \
100-
apps/files_external/tests/Storage/Amazons3Test.php \
101-
--log-junit junit.xml \
102-
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
98+
run: |
99+
composer run test:files_external -- \
100+
--group S3 \
101+
--log-junit junit.xml \
102+
apps/files_external/tests/Storage \
103+
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
103104
104105
- name: Upload code coverage
105106
if: ${{ !cancelled() && matrix.coverage }}
@@ -114,6 +115,11 @@ jobs:
114115
with:
115116
flags: phpunit-files-external-s3
116117

118+
- name: Nextcloud logs
119+
if: always()
120+
run: |
121+
cat data/nextcloud.log
122+
117123
- name: S3 logs
118124
if: always()
119125
run: |
@@ -128,7 +134,7 @@ jobs:
128134

129135
strategy:
130136
matrix:
131-
php-versions: ['8.1', '8.2', '8.3']
137+
php-versions: ['8.1', '8.2', '8.4']
132138
include:
133139
- php-versions: '8.3'
134140
coverage: ${{ github.event_name != 'pull_request' }}
@@ -140,7 +146,7 @@ jobs:
140146
env:
141147
SERVICES: s3
142148
DEBUG: 1
143-
image: localstack/localstack@sha256:b52c16663c70b7234f217cb993a339b46686e30a1a5d9279cb5feeb2202f837c # v4.4.0
149+
image: localstack/localstack@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d # v4.5.0
144150
ports:
145151
- "4566:4566"
146152

@@ -167,14 +173,15 @@ jobs:
167173
composer install
168174
./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
169175
./occ app:enable --force files_external
170-
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
176+
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
171177
172178
- name: PHPUnit
173-
run: composer run test:files_external -- \
174-
apps/files_external/tests/Storage/Amazons3Test.php \
175-
apps/files_external/tests/Storage/VersionedAmazonS3Test.php \
176-
--log-junit junit.xml \
177-
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
179+
run: |
180+
composer run test:files_external -- \
181+
--group S3 \
182+
--log-junit junit.xml \
183+
apps/files_external/tests/Storage \
184+
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}
178185
179186
- name: Upload code coverage
180187
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
@@ -13,6 +13,7 @@
1313
* Class Amazons3Test
1414
*
1515
* @group DB
16+
* @group S3
1617
*
1718
* @package OCA\Files_External\Tests\Storage
1819
*/
@@ -25,7 +26,7 @@ protected function setUp(): void {
2526
parent::setUp();
2627

2728
$this->config = include('files_external/tests/config.amazons3.php');
28-
if (! is_array($this->config) or ! $this->config['run']) {
29+
if (!is_array($this->config) || !$this->config['run']) {
2930
$this->markTestSkipped('AmazonS3 backend not configured');
3031
}
3132
$this->instance = new AmazonS3($this->config + [
@@ -45,8 +46,4 @@ protected function tearDown(): void {
4546
public function testStat(): void {
4647
$this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
4748
}
48-
49-
public function testHashInFileName(): void {
50-
$this->markTestSkipped('Localstack has a bug with hashes in filename');
51-
}
5249
}

apps/files_external/tests/Storage/Amazons3Test.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@
1414
* Class Amazons3Test
1515
*
1616
* @group DB
17+
* @group S3
1718
*
1819
* @package OCA\Files_External\Tests\Storage
1920
*/
2021
class Amazons3Test extends \Test\Files\Storage\Storage {
21-
private $config;
22+
protected $config;
2223
/** @var AmazonS3 */
2324
protected $instance;
2425

2526
protected function setUp(): void {
2627
parent::setUp();
2728

2829
$this->config = include('files_external/tests/config.amazons3.php');
29-
if (! is_array($this->config) or ! $this->config['run']) {
30+
if (!is_array($this->config) || !$this->config['run']) {
3031
$this->markTestSkipped('AmazonS3 backend not configured');
3132
}
3233
$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/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)