Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions .github/workflows/files-external-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:

strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3', '8.4']
php-versions: ['8.1', '8.2', '8.4']
include:
- php-versions: '8.2'
- php-versions: '8.3'
coverage: ${{ github.event_name != 'pull_request' }}

name: php${{ matrix.php-versions }}-s3
Expand Down Expand Up @@ -87,18 +87,19 @@ jobs:
composer install
./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
./occ app:enable --force files_external
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
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

- name: Wait for S3
run: |
sleep 10
curl -f -m 1 --retry-connrefused --retry 10 --retry-delay 10 http://localhost:9000/minio/health/ready

- name: PHPUnit
run: composer run test:files_external -- \
apps/files_external/tests/Storage/Amazons3Test.php \
apps/files_external/tests/Storage/VersionedAmazonS3Test.php \
${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
run: |
composer run test:files_external -- \
--group S3 \
--log-junit junit.xml \
apps/files_external/tests/Storage \
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}

- name: Upload code coverage
if: ${{ !cancelled() && matrix.coverage }}
Expand All @@ -121,7 +122,7 @@ jobs:

strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.1', '8.2', '8.4']
include:
- php-versions: '8.3'
coverage: true
Expand All @@ -133,7 +134,7 @@ jobs:
env:
SERVICES: s3
DEBUG: 1
image: localstack/localstack@sha256:b52c16663c70b7234f217cb993a339b46686e30a1a5d9279cb5feeb2202f837c # v4.4.0
image: localstack/localstack@sha256:9d4253786e0effe974d77fe3c390358391a56090a4fff83b4600d8a64404d95d # v4.5.0
ports:
- "4566:4566"

Expand All @@ -160,13 +161,15 @@ jobs:
composer install
./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
./occ app:enable --force files_external
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
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

- name: PHPUnit
run: composer run test:files_external -- \
apps/files_external/tests/Storage/Amazons3Test.php \
apps/files_external/tests/Storage/VersionedAmazonS3Test.php \
${{ matrix.coverage && ' --coverage-clover ./clover.xml' || '' }}
run: |
composer run test:files_external -- \
--group S3 \
--log-junit junit.xml \
apps/files_external/tests/Storage \
${{ matrix.coverage && '--coverage-clover ./clover.xml' || '' }}

- name: Upload code coverage
if: ${{ !cancelled() && matrix.coverage }}
Expand Down
7 changes: 2 additions & 5 deletions apps/files_external/tests/Storage/Amazons3MultiPartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Class Amazons3Test
*
* @group DB
* @group S3
*
* @package OCA\Files_External\Tests\Storage
*/
Expand All @@ -23,7 +24,7 @@ protected function setUp(): void {
parent::setUp();

$this->config = include('files_external/tests/config.amazons3.php');
if (! is_array($this->config) or ! $this->config['run']) {
if (!is_array($this->config) || !$this->config['run']) {
$this->markTestSkipped('AmazonS3 backend not configured');
}
$this->instance = new AmazonS3($this->config + [
Expand All @@ -43,8 +44,4 @@ protected function tearDown(): void {
public function testStat(): void {
$this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
}

public function testHashInFileName(): void {
$this->markTestSkipped('Localstack has a bug with hashes in filename');
}
}
9 changes: 3 additions & 6 deletions apps/files_external/tests/Storage/Amazons3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
* Class Amazons3Test
*
* @group DB
* @group S3
*
* @package OCA\Files_External\Tests\Storage
*/
class Amazons3Test extends \Test\Files\Storage\Storage {
private $config;
protected $config;
/** @var AmazonS3 */
protected $instance;

protected function setUp(): void {
parent::setUp();

$this->config = include('files_external/tests/config.amazons3.php');
if (! is_array($this->config) or ! $this->config['run']) {
if (!is_array($this->config) || !$this->config['run']) {
$this->markTestSkipped('AmazonS3 backend not configured');
}
$this->instance = new AmazonS3($this->config);
Expand All @@ -41,8 +42,4 @@ protected function tearDown(): void {
public function testStat(): void {
$this->markTestSkipped('S3 doesn\'t update the parents folder mtime');
}

public function testHashInFileName(): void {
$this->markTestSkipped('Localstack has a bug with hashes in filename');
}
}
9 changes: 9 additions & 0 deletions apps/files_external/tests/Storage/VersionedAmazonS3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* @group DB
* @group S3
*/
class VersionedAmazonS3Test extends Amazons3Test {
protected function setUp(): void {
Expand All @@ -25,4 +26,12 @@ protected function setUp(): void {
$this->markTestSkipped("s3 backend doesn't seem to support versioning");
}
}

public function testCopyOverWriteDirectory(): void {
if (isset($this->config['minio'])) {
$this->markTestSkipped('MinIO has a bug with batch deletion on versioned storages, see https://github.com/minio/minio/issues/21366');
}

parent::testCopyOverWriteDirectory();
}
}
Loading