summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-09-15 16:40:52 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-09-16 01:56:49 +0100
commit17d1358aee1fe8f1dde6a780b8ac021413bfb986 (patch)
tree9f4978a858cb07a90efcf7126b0c427c1fa5c62e /apps/files_external
parente545c2eec56c1f5c99485d4a29949d975961084c (diff)
downloadnextcloud-server-17d1358aee1fe8f1dde6a780b8ac021413bfb986.tar.gz
nextcloud-server-17d1358aee1fe8f1dde6a780b8ac021413bfb986.zip
AmazonS3 Ceph tests
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/tests/backends/amazons3.php6
-rwxr-xr-xapps/files_external/tests/env/start-amazons3-ceph.sh81
-rwxr-xr-xapps/files_external/tests/env/stop-amazons3-ceph.sh36
3 files changed, 120 insertions, 3 deletions
diff --git a/apps/files_external/tests/backends/amazons3.php b/apps/files_external/tests/backends/amazons3.php
index 1923ddc30b1..7e88f3d0b74 100644
--- a/apps/files_external/tests/backends/amazons3.php
+++ b/apps/files_external/tests/backends/amazons3.php
@@ -32,11 +32,11 @@ class AmazonS3 extends Storage {
protected function setUp() {
parent::setUp();
- $this->config = include('files_external/tests/config.php');
- if ( ! is_array($this->config) or ! isset($this->config['amazons3']) or ! $this->config['amazons3']['run']) {
+ $this->config = include('files_external/tests/config.amazons3.php');
+ if ( ! is_array($this->config) or ! $this->config['run']) {
$this->markTestSkipped('AmazonS3 backend not configured');
}
- $this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']);
+ $this->instance = new \OC\Files\Storage\AmazonS3($this->config);
}
protected function tearDown() {
diff --git a/apps/files_external/tests/env/start-amazons3-ceph.sh b/apps/files_external/tests/env/start-amazons3-ceph.sh
new file mode 100755
index 00000000000..5f274f10ca2
--- /dev/null
+++ b/apps/files_external/tests/env/start-amazons3-ceph.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# This script start a docker container to test the files_external tests
+# against. It will also change the files_external config to use the docker
+# container as testing environment. This is reverted in the stop step.W
+#
+# Set environment variable DEBUG to print config file
+#
+# @author Morris Jobke
+# @author Robin McCorkell
+# @copyright 2015 ownCloud
+
+if ! command -v docker >/dev/null 2>&1; then
+ echo "No docker executable found - skipped docker setup"
+ exit 0;
+fi
+
+echo "Docker executable found - setup docker"
+
+docker_image=xenopathic/ceph-keystone
+
+echo "Fetch recent ${docker_image} docker image"
+docker pull ${docker_image}
+
+# retrieve current folder to place the config in the parent folder
+thisFolder=`echo $0 | replace "env/start-amazons3-ceph.sh" ""`
+
+if [ -z "$thisFolder" ]; then
+ thisFolder="."
+fi;
+
+user=test
+accesskey=aaabbbccc
+secretkey=cccbbbaaa
+bucket=testbucket
+port=80
+
+container=`docker run -d \
+ -e RGW_CIVETWEB_PORT=$port \
+ ${docker_image}`
+
+host=`docker inspect $container | grep IPAddress | cut -d '"' -f 4`
+
+
+echo "${docker_image} container: $container"
+
+# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
+echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.amazons3
+
+# TODO find a way to determine the successful initialization inside the docker container
+echo "Waiting 20 seconds for ceph initialization ... "
+sleep 20
+
+echo "Create ceph user"
+docker exec $container radosgw-admin user create \
+ --uid="$user" --display-name="$user" \
+ --access-key="$accesskey" --secret="$secretkey" \
+ >/dev/null
+
+cat > $thisFolder/config.amazons3.php <<DELIM
+<?php
+
+return array(
+ 'run'=>true,
+ 'bucket'=>'$bucket',
+ 'hostname'=>'$host',
+ 'port'=>'$port',
+ 'key'=>'$accesskey',
+ 'secret'=>'$secretkey',
+ 'use_ssl'=>false,
+ 'use_path_style'=>true,
+);
+
+DELIM
+
+if [ -n "$DEBUG" ]; then
+ cat $thisFolder/config.amazons3.php
+ cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.amazons3
+fi
diff --git a/apps/files_external/tests/env/stop-amazons3-ceph.sh b/apps/files_external/tests/env/stop-amazons3-ceph.sh
new file mode 100755
index 00000000000..01b39b4c680
--- /dev/null
+++ b/apps/files_external/tests/env/stop-amazons3-ceph.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# This script stops the docker container the files_external tests were run
+# against. It will also revert the config changes done in start step.
+#
+# @author Morris Jobke
+# @author Robin McCorkell
+# @copyright 2015 ownCloud
+
+if ! command -v docker >/dev/null 2>&1; then
+ echo "No docker executable found - skipped docker stop"
+ exit 0;
+fi
+
+echo "Docker executable found - stop and remove docker containers"
+
+# retrieve current folder to remove the config from the parent folder
+thisFolder=`echo $0 | replace "env/stop-amazons3-ceph.sh" ""`
+
+if [ -z "$thisFolder" ]; then
+ thisFolder="."
+fi;
+
+# stopping and removing docker containers
+for container in `cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.amazons3`; do
+ echo "Stopping and removing docker container $container"
+ # kills running container and removes it
+ docker rm -f $container
+done;
+
+# cleanup
+rm $thisFolder/config.amazons3.php
+rm $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.amazons3
+