From 4c9686a969af8e6959d23d658a0cd981ad4b4bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 28 May 2021 09:49:42 +0200 Subject: [PATCH 1/2] Run s3 tests again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .drone.yml | 2 ++ tests/lib/Files/ObjectStore/S3Test.php | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index fee6ce6f620ac..ca21cb7464340 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2097,6 +2097,7 @@ steps: - name: object-store image: nextcloudci/php7.4:php7.4-3 environment: + OBJECT_STORE: s3 CODECOV_TOKEN: from_secret: CODECOV_TOKEN commands: @@ -2130,6 +2131,7 @@ steps: - name: object-store image: nextcloudci/php7.4:php7.4-3 environment: + OBJECT_STORE: azure CODECOV_TOKEN: from_secret: CODECOV_TOKEN commands: diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index c1e7948e3c44b..07d3e2f7d79ca 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -62,7 +62,7 @@ public function stream_seek($offset, $whence = SEEK_SET) { class S3Test extends ObjectStoreTest { protected function getInstance() { $config = \OC::$server->getConfig()->getSystemValue('objectstore'); - if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') { + if (!is_array($config) || $config['class'] !== S3::class) { $this->markTestSkipped('objectstore not configured for s3'); } @@ -70,11 +70,6 @@ protected function getInstance() { } public function testUploadNonSeekable() { - $config = \OC::$server->getConfig()->getSystemValue('objectstore'); - if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') { - $this->markTestSkipped('objectstore not configured for s3'); - } - $s3 = $this->getInstance(); $s3->writeObject('multiparttest', NonSeekableStream::wrap(fopen(__FILE__, 'r'))); From e41f06d7c466f14e417f7d7930c7a7d6146dde8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 28 May 2021 19:24:21 +0200 Subject: [PATCH 2/2] Use minio for s3 tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .drone.yml | 9 +++++++++ tests/drone-wait-objectstore.sh | 6 ++++++ tests/preseed-config.php | 8 ++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index ca21cb7464340..caec2fccd34fb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2090,6 +2090,15 @@ kind: pipeline name: object-store-s3 steps: +- name: minio + image: ghcr.io/nextcloud/continuous-integration-minio:latest + detach: true + commands: + - mkdir /s3data + - minio server /s3data + environment: + MINIO_ROOT_USER: nextcloud + MINIO_ROOT_PASSWORD: nextcloud - name: submodules image: docker:git commands: diff --git a/tests/drone-wait-objectstore.sh b/tests/drone-wait-objectstore.sh index 7914d45bed1df..7817d946682f9 100755 --- a/tests/drone-wait-objectstore.sh +++ b/tests/drone-wait-objectstore.sh @@ -12,6 +12,12 @@ function get_swift_token() { fi } +if [ "$OBJECT_STORE" == "s3" ]; then + echo "Waiting for minio to be ready" + timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://minio:9000)" != "403" ]]; do sleep 5; done' || ( + echo "Failed to wait for minio to be ready" && exit 1 + ) +fi if [ "$OBJECT_STORE" == "swift" ]; then echo "waiting for keystone" until get_swift_token diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 97c8a1d11a814..16aea87c8a7a2 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -25,10 +25,10 @@ 'arguments' => [ 'bucket' => 'nextcloud', 'autocreate' => true, - 'key' => 'dummy', - 'secret' => 'dummy', - 'hostname' => getenv('DRONE') === 'true' ? 'fake-s3' : 'localhost', - 'port' => 4569, + 'key' => 'nextcloud', + 'secret' => 'nextcloud', + 'hostname' => getenv('DRONE') === 'true' ? 'minio' : 'localhost', + 'port' => 9000, 'use_ssl' => false, // required for some non amazon s3 implementations 'use_path_style' => true