From f72fea8d0ec5ff00a31c81a17059547becb2c37e Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 5 Aug 2016 13:13:49 +0000 Subject: [PATCH 1/9] Modified run.sh to mount a local storage --- build/integration/local_storage/hello.txt | 1 + build/integration/run.sh | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 build/integration/local_storage/hello.txt diff --git a/build/integration/local_storage/hello.txt b/build/integration/local_storage/hello.txt new file mode 100644 index 00000000000..e1ec11389c7 --- /dev/null +++ b/build/integration/local_storage/hello.txt @@ -0,0 +1 @@ +Hello local storage diff --git a/build/integration/run.sh b/build/integration/run.sh index eccb378eec4..3a5bb1153d8 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -36,12 +36,20 @@ echo $PHPPID_FED export TEST_SERVER_URL="http://localhost:$PORT/ocs/" export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" +APACHE_USER=`ps -ef | egrep '(httpd|apache2|apache)' | grep -v \`whoami\` | grep -v root | head -n1 | awk '{print $1}'` + +OUTPUT_CREATE_STORAGE=`sudo -u $APACHE_USER ../../occ files_external:create local_storage local null::null -c datadir=./build/integration/local_storage` + +ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` + vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN RESULT=$? kill $PHPPID kill $PHPPID_FED +sudo -u $APACHE_USER ../../occ files_external:delete -y $ID_STORAGE + if [ -z $HIDE_OC_LOGS ]; then tail "../../data/nextcloud.log" fi From 85f00e2c0144a9420ae928f27235bb142aad2c17 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Mon, 8 Aug 2016 13:17:28 +0000 Subject: [PATCH 2/9] Added feature and context, not working yet, option to allow sharing needs to be added --- .../bootstrap/ExternalStorageContext.php | 24 +++++++++++++++++ .../features/external-storage.feature | 26 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 build/integration/features/bootstrap/ExternalStorageContext.php create mode 100644 build/integration/features/external-storage.feature diff --git a/build/integration/features/bootstrap/ExternalStorageContext.php b/build/integration/features/bootstrap/ExternalStorageContext.php new file mode 100644 index 00000000000..90dc06cf571 --- /dev/null +++ b/build/integration/features/bootstrap/ExternalStorageContext.php @@ -0,0 +1,24 @@ +isDir() ? rmdir($file) : unlink($file); + } + } +} diff --git a/build/integration/features/external-storage.feature b/build/integration/features/external-storage.feature new file mode 100644 index 00000000000..ac8bd971edf --- /dev/null +++ b/build/integration/features/external-storage.feature @@ -0,0 +1,26 @@ +Feature: external-storage + Background: + Given using api version "1" + Given using dav path "remote.php/webdav" + + Scenario: Share by link a file inside a local external storage + Given user "user0" exists + And user "user1" exists + And As an "user0" + And user "user0" created a folder "/local_storage/foo" + And User "user0" moved file "/textfile0.txt" to "/local_storage/foo/textfile0.txt" + And folder "/local_storage/foo" of user "user0" is shared with user "user1" + And As an "user1" + When creating a share with + | path | foo | + | shareType | 3 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And Share fields of last share match with + | id | A_NUMBER | + | url | AN_URL | + | token | A_TOKEN | + | mimetype | httpd/unix-directory | + And Public shared file "/foo/textfile0.txt" can be downloaded + + From b154c8fa394fd980fea65b5bd29b8cfb12d3f43c Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Tue, 9 Aug 2016 08:24:03 +0000 Subject: [PATCH 3/9] Removed extra context added needed option and remove storage after external storage scenarios --- .../features/bootstrap/BasicStructure.php | 12 ++++++++++ .../bootstrap/ExternalStorageContext.php | 24 ------------------- .../features/external-storage.feature | 2 +- build/integration/local_storage/hello.txt | 1 - build/integration/run.sh | 2 ++ 5 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 build/integration/features/bootstrap/ExternalStorageContext.php delete mode 100644 build/integration/local_storage/hello.txt diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index e9e20c047aa..4330a324ad3 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -344,4 +344,16 @@ trait BasicStructure { rmdir("../../core/skeleton/PARENT"); } } + + /** + * @AfterScenario @local_storage + */ + public static function removeFilesFromLocalStorage(){ + $dir = "./local_storage/"; + $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); + $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); + foreach ( $ri as $file ) { + $file->isDir() ? rmdir($file) : unlink($file); + } + } } diff --git a/build/integration/features/bootstrap/ExternalStorageContext.php b/build/integration/features/bootstrap/ExternalStorageContext.php deleted file mode 100644 index 90dc06cf571..00000000000 --- a/build/integration/features/bootstrap/ExternalStorageContext.php +++ /dev/null @@ -1,24 +0,0 @@ -isDir() ? rmdir($file) : unlink($file); - } - } -} diff --git a/build/integration/features/external-storage.feature b/build/integration/features/external-storage.feature index ac8bd971edf..9e53b01346e 100644 --- a/build/integration/features/external-storage.feature +++ b/build/integration/features/external-storage.feature @@ -3,6 +3,7 @@ Feature: external-storage Given using api version "1" Given using dav path "remote.php/webdav" + @local_storage Scenario: Share by link a file inside a local external storage Given user "user0" exists And user "user1" exists @@ -21,6 +22,5 @@ Feature: external-storage | url | AN_URL | | token | A_TOKEN | | mimetype | httpd/unix-directory | - And Public shared file "/foo/textfile0.txt" can be downloaded diff --git a/build/integration/local_storage/hello.txt b/build/integration/local_storage/hello.txt deleted file mode 100644 index e1ec11389c7..00000000000 --- a/build/integration/local_storage/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello local storage diff --git a/build/integration/run.sh b/build/integration/run.sh index 3a5bb1153d8..be2e7684dc6 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -42,6 +42,8 @@ OUTPUT_CREATE_STORAGE=`sudo -u $APACHE_USER ../../occ files_external:create loca ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` +sudo -u $APACHE_USER ../../occ files_external:option $ID_STORAGE enable_sharing true + vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN RESULT=$? From b7b0f4780c0e229bd6fea7e0d9f00da0c7c93607 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 10 Aug 2016 07:26:35 +0000 Subject: [PATCH 4/9] Run as current user --- build/integration/run.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build/integration/run.sh b/build/integration/run.sh index be2e7684dc6..671ca7b9578 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -36,13 +36,11 @@ echo $PHPPID_FED export TEST_SERVER_URL="http://localhost:$PORT/ocs/" export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" -APACHE_USER=`ps -ef | egrep '(httpd|apache2|apache)' | grep -v \`whoami\` | grep -v root | head -n1 | awk '{print $1}'` - -OUTPUT_CREATE_STORAGE=`sudo -u $APACHE_USER ../../occ files_external:create local_storage local null::null -c datadir=./build/integration/local_storage` +OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/local_storage` ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` -sudo -u $APACHE_USER ../../occ files_external:option $ID_STORAGE enable_sharing true +../../occ files_external:option $ID_STORAGE enable_sharing true vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN RESULT=$? @@ -50,7 +48,7 @@ RESULT=$? kill $PHPPID kill $PHPPID_FED -sudo -u $APACHE_USER ../../occ files_external:delete -y $ID_STORAGE +../../occ files_external:delete -y $ID_STORAGE if [ -z $HIDE_OC_LOGS ]; then tail "../../data/nextcloud.log" From 3a5d29fb59c3b96b80b4fd5e2776f998020a1abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Bertol=C3=ADn?= Date: Fri, 12 Aug 2016 07:11:07 +0000 Subject: [PATCH 5/9] Added local_storage folder --- build/integration/local_storage/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 build/integration/local_storage/.gitignore diff --git a/build/integration/local_storage/.gitignore b/build/integration/local_storage/.gitignore new file mode 100644 index 00000000000..5e7d2734cfc --- /dev/null +++ b/build/integration/local_storage/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore From 7106129baac765c7296ccebf70910a83058ae3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Bertol=C3=ADn?= Date: Fri, 26 Aug 2016 07:57:48 +0000 Subject: [PATCH 6/9] External storage was not enabled and content was not deleted before scenarios --- .../features/bootstrap/BasicStructure.php | 14 +++++++++++++- build/integration/run.sh | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 4330a324ad3..758a2d5d455 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -345,10 +345,22 @@ trait BasicStructure { } } + /** + * @BeforeScenario @local_storage + */ + public static function removeFilesFromLocalStorageBefore(){ + $dir = "./local_storage/"; + $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); + $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); + foreach ( $ri as $file ) { + $file->isDir() ? rmdir($file) : unlink($file); + } + } + /** * @AfterScenario @local_storage */ - public static function removeFilesFromLocalStorage(){ + public static function removeFilesFromLocalStorageAfter(){ $dir = "./local_storage/"; $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); diff --git a/build/integration/run.sh b/build/integration/run.sh index 671ca7b9578..69190f7a31d 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -36,6 +36,9 @@ echo $PHPPID_FED export TEST_SERVER_URL="http://localhost:$PORT/ocs/" export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" +#Enable external storage app +../../occ app:enable files_external + OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/local_storage` ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` @@ -50,6 +53,9 @@ kill $PHPPID_FED ../../occ files_external:delete -y $ID_STORAGE +#Disable external storage app +../../occ app:disable files_external + if [ -z $HIDE_OC_LOGS ]; then tail "../../data/nextcloud.log" fi From 86cfcde5e990fdd165f24d1b11abd43a5b391595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Bertol=C3=ADn?= Date: Fri, 26 Aug 2016 10:52:11 +0000 Subject: [PATCH 7/9] Changed enabled/disabled app in provisioning api tests --- build/integration/features/provisioning-v1.feature | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index 38ed5213b19..63f8bcec5cc 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -295,6 +295,7 @@ Feature: provisioning | theming | | updatenotification | | workflowengine | + | files_external | Scenario: get app info Given As an "admin" @@ -304,19 +305,19 @@ Feature: provisioning Scenario: enable an app Given As an "admin" - And app "files_external" is disabled - When sending "POST" to "/cloud/apps/files_external" + And app "user_ldap" is disabled + When sending "POST" to "/cloud/apps/user_ldap" Then the OCS status code should be "100" And the HTTP status code should be "200" - And app "files_external" is enabled + And app "user_ldap" is enabled Scenario: disable an app Given As an "admin" - And app "files_external" is enabled - When sending "DELETE" to "/cloud/apps/files_external" + And app "user_ldap" is enabled + When sending "DELETE" to "/cloud/apps/user_ldap" Then the OCS status code should be "100" And the HTTP status code should be "200" - And app "files_external" is disabled + And app "user_ldap" is disabled Scenario: disable an user Given As an "admin" From 81c18f5aa789260d7d0091d133125a018d62547a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Bertol=C3=ADn?= Date: Tue, 30 Aug 2016 10:53:19 +0000 Subject: [PATCH 8/9] Creating the folder when the tests run --- build/integration/features/bootstrap/BasicStructure.php | 4 ++-- build/integration/local_storage/.gitignore | 4 ---- build/integration/run.sh | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 build/integration/local_storage/.gitignore diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 758a2d5d455..e6da74601ba 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -349,7 +349,7 @@ trait BasicStructure { * @BeforeScenario @local_storage */ public static function removeFilesFromLocalStorageBefore(){ - $dir = "./local_storage/"; + $dir = "./work/local_storage/"; $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); foreach ( $ri as $file ) { @@ -361,7 +361,7 @@ trait BasicStructure { * @AfterScenario @local_storage */ public static function removeFilesFromLocalStorageAfter(){ - $dir = "./local_storage/"; + $dir = "./work/local_storage/"; $di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS); $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST); foreach ( $ri as $file ) { diff --git a/build/integration/local_storage/.gitignore b/build/integration/local_storage/.gitignore deleted file mode 100644 index 5e7d2734cfc..00000000000 --- a/build/integration/local_storage/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/build/integration/run.sh b/build/integration/run.sh index 69190f7a31d..cf42ed75e4c 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -39,7 +39,8 @@ export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" #Enable external storage app ../../occ app:enable files_external -OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/local_storage` +mkdir -p work/local_storage +OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/work/local_storage` ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` From 84c742b95e338ebd61e8c4b829cf61913ad386dc Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 31 Aug 2016 10:40:17 +0200 Subject: [PATCH 9/9] Use "testing" instead of "user_ldap" as test app --- build/integration/features/provisioning-v1.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index 63f8bcec5cc..785b795bf35 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -305,19 +305,19 @@ Feature: provisioning Scenario: enable an app Given As an "admin" - And app "user_ldap" is disabled - When sending "POST" to "/cloud/apps/user_ldap" + And app "testing" is disabled + When sending "POST" to "/cloud/apps/testing" Then the OCS status code should be "100" And the HTTP status code should be "200" - And app "user_ldap" is enabled + And app "testing" is enabled Scenario: disable an app Given As an "admin" - And app "user_ldap" is enabled - When sending "DELETE" to "/cloud/apps/user_ldap" + And app "testing" is enabled + When sending "DELETE" to "/cloud/apps/testing" Then the OCS status code should be "100" And the HTTP status code should be "200" - And app "user_ldap" is disabled + And app "testing" is disabled Scenario: disable an user Given As an "admin"