Browse Source

add ci support for s3 object store

Signed-off-by: Robin Appelman <robin@icewind.nl>
Robin Appelman 7 years ago
parent
commit
ac2542f0f0
4 changed files with 40 additions and 0 deletions
  1. 17 0
      .drone.yml
  2. 3 0
      autotest.sh
  3. 3 0
      tests/lib/Files/ObjectStore/S3Test.php
  4. 17 0
      tests/preseed-config.php

+ 17 - 0
.drone.yml

@@ -415,6 +415,16 @@ pipeline:
     when:
       matrix:
         TESTS: db-codecov
+  object-store:
+      image: nextcloudci/php7.0:php7.0-7
+      commands:
+        - TEST_SELECTION=PRIMARY-${OBJECT_STORE} ./autotest.sh sqlite
+        - wget https://codecov.io/bash -O codecov.sh
+        - sh -c "if [ '$DRONE_BUILD_EVENT' = 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -P $DRONE_PULL_REQUEST -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
+        - sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
+      when:
+        matrix:
+          TESTS: object-store
   memcache-memcached:
     image: nextcloudci/php7.0-memcached:php7.0-memcached-6
     commands:
@@ -462,6 +472,8 @@ matrix:
     - TESTS: litmus-v2
     - TESTS: caldavtester
     - TESTS: carddavtester
+    - TESTS: object-store
+      OBJECT_STORE: s3
     - TESTS: sqlite-php7.0-samba-native
     - TESTS: sqlite-php7.0-samba-non-native
     - TEST: memcache-memcached
@@ -517,3 +529,8 @@ services:
     when:
       matrix:
         DB: mysqlmb4
+  fake-s3:
+      image: lphoward/fake-s3
+      when:
+        matrix:
+          OBJECT_STORE: s3

+ 3 - 0
autotest.sh

@@ -344,6 +344,9 @@ function execute_tests {
 	if [ "$TEST_SELECTION" == "NODB" ]; then
 		GROUP='--exclude-group DB,SLOWDB'
 	fi
+	if [ "$TEST_SELECTION" == "PRIMARY-s3" ]; then
+		GROUP='--group PRIMARY-s3'
+	fi
 
 	COVER=''
 	if [ -z "$NOCOVERAGE" ]; then

+ 3 - 0
tests/lib/Files/ObjectStore/S3Test.php

@@ -23,6 +23,9 @@ namespace Test\Files\ObjectStore;
 
 use OC\Files\ObjectStore\S3;
 
+/**
+ * @group PRIMARY-s3
+ */
 class S3Test extends ObjectStoreTest {
 	/**
 	 * @return \OCP\Files\ObjectStore\IObjectStore

+ 17 - 0
tests/preseed-config.php

@@ -21,3 +21,20 @@ if (is_dir(OC::$SERVERROOT.'/apps2')) {
 if (substr(strtolower(PHP_OS), 0, 3) === 'win') {
 	$CONFIG['openssl'] = ['config' => OC::$SERVERROOT . '/tests/data/openssl.cnf'];
 }
+
+if (getenv('OBJECT_STORE') === 's3') {
+	$CONFIG['objectstore'] = [
+		'class' => 'OC\\Files\\ObjectStore\\S3',
+		'arguments' => array(
+			'bucket' => 'nextcloud',
+			'autocreate' => true,
+			'key' => 'dummy',
+			'secret' => 'dummy',
+			'hostname' => 'localhost',
+			'port' => 4569,
+			'use_ssl' => false,
+			// required for some non amazon s3 implementations
+			'use_path_style' => true
+		)
+	];
+}