diff --git a/Jenkinsfile b/Jenkinsfile index 1f1362e7abcd..31d5be2174d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,6 +119,18 @@ timestampedNode('SLAVE') { ./run.sh ''' } + + executeAndReport('build/integration/output/*.xml') { + sh '''phpenv local 7.0 + rm -rf config/config.php + ./occ maintenance:install --admin-pass=admin + rm -rf build/integration/output + rm -rf build/integration/vendor + rm -rf build/integration/composer.lock + cd build/integration + OC_TEST_ALT_HOME=1 ./run.sh + ''' + } } } diff --git a/build/integration/data/file_to_overwrite.txt b/build/integration/data/file_to_overwrite.txt new file mode 100644 index 000000000000..f45c3ef31ee5 --- /dev/null +++ b/build/integration/data/file_to_overwrite.txt @@ -0,0 +1 @@ +BLABLABLA diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 5b245f33e230..215f089bd8c5 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -297,8 +297,8 @@ public static function removeFile($path, $filename){ * @param string $text */ public function modifyTextOfFile($user, $filename, $text) { - self::removeFile("../../data/$user/files", "$filename"); - file_put_contents("../../data/$user/files" . "$filename", "$text"); + self::removeFile($this->getUserHome($user) . "/files", "$filename"); + file_put_contents($this->getUserHome($user) . "/files" . "$filename", "$text"); } /** @@ -312,7 +312,7 @@ public function emptyTrashbin($user) { } public function createFileSpecificSize($name, $size){ - $file = fopen("data/" . "$name", 'w'); + $file = fopen("work/" . "$name", 'w'); fseek($file, $size - 1 ,SEEK_CUR); fwrite($file,'a'); // write a dummy char at SIZE position fclose($file); diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index f4ac9f3346a3..58ecd659674d 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -486,6 +486,9 @@ public function theAppsShouldBe($appList) { $apps = $appList->getRows(); $appsSimplified = $this->simplifyArray($apps); $respondedArray = $this->getArrayOfAppsResponded($this->response); + if(($key = array_search('testing', $respondedArray)) !== false) { + array_splice($respondedArray, $key, 1); + } PHPUnit_Framework_Assert::assertEquals($appsSimplified, $respondedArray, "", 0.0, 10, true); } @@ -637,6 +640,19 @@ public function userHasUnlimitedQuota($user) $this->userHasAQuotaOf($user, 'none'); } + /** + * Returns home path of the given user + * @param string $user + */ + public function getUserHome($user) { + $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/cloud/users/$user"; + $client = new Client(); + $options = []; + $options['auth'] = $this->adminUser; + $this->response = $client->get($fullUrl, $options); + return $this->response->xml()->data[0]->home; + } + /** * @BeforeScenario * @AfterScenario diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 97aaf4fffabc..dd05a5551748 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -441,10 +441,11 @@ public function userUploadsAFileTo($user, $source, $destination) public function userAddsAFileTo($user, $bytes, $destination){ $filename = "filespecificSize.txt"; $this->createFileSpecificSize($filename, $bytes); - PHPUnit_Framework_Assert::assertEquals(1, file_exists("data/$filename")); - $this->userUploadsAFileTo($user, "data/$filename", $destination); - $this->removeFile("data/", $filename); - PHPUnit_Framework_Assert::assertEquals(1, file_exists("../../data/$user/files$destination")); + PHPUnit_Framework_Assert::assertEquals(1, file_exists("work/$filename")); + $this->userUploadsAFileTo($user, "work/$filename", $destination); + $this->removeFile("work/", $filename); + $expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]); + $this->checkElementList($user, $expectedElements); } /** diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index 8bf8e921b0ff..70c4b10a106d 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -130,9 +130,10 @@ Feature: federated And User "user1" from server "REMOTE" accepts last pending share And Using server "REMOTE" And As an "user1" - And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA" - When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt" - And Downloading file "/textfile0 (2).txt" with range "bytes=0-8" + When User "user1" uploads file "data/file_to_overwrite.txt" to "/textfile0 (2).txt" + And Using server "LOCAL" + And As an "user0" + And Downloading file "/textfile0.txt" with range "bytes=0-8" Then Downloaded content should be "BLABLABLA" Scenario: Overwrite a federated shared folder as recipient @@ -145,9 +146,10 @@ Feature: federated And User "user1" from server "REMOTE" accepts last pending share And Using server "REMOTE" And As an "user1" - And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA" - When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/PARENT (2)/textfile0.txt" - And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8" + When User "user1" uploads file "data/file_to_overwrite.txt" to "/PARENT (2)/textfile0.txt" + And Using server "LOCAL" + And As an "user0" + And Downloading file "/PARENT/textfile0.txt" with range "bytes=0-8" Then Downloaded content should be "BLABLABLA" Scenario: Overwrite a federated shared file as recipient using old chunking diff --git a/build/integration/run.sh b/build/integration/run.sh index 8afbaa17bef3..51b8456b9db5 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -8,6 +8,15 @@ OCC=${OC_PATH}occ SCENARIO_TO_RUN=$1 HIDE_OC_LOGS=$2 +function env_alt_home_enable { + $OCC app:enable testing + $OCC config:app:set testing enable_alt_user_backend --value yes +} + +function env_alt_home_clear { + $OCC app:disable testing +} + # avoid port collision on jenkins - use $EXECUTOR_NUMBER if [ -z "$EXECUTOR_NUMBER" ]; then EXECUTOR_NUMBER=0 @@ -37,6 +46,10 @@ ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}` $OCC files_external:option $ID_STORAGE enable_sharing true +if test "$OC_TEST_ALT_HOME" = "1"; then + env_alt_home_enable +fi + vendor/bin/behat --strict -f junit -f pretty $SCENARIO_TO_RUN RESULT=$? @@ -48,6 +61,10 @@ $OCC files_external:delete -y $ID_STORAGE #Disable external storage app $OCC app:disable files_external +if test "$OC_TEST_ALT_HOME" = "1"; then + env_alt_home_clear +fi + if [ -z $HIDE_OC_LOGS ]; then tail "${OC_PATH}/data/owncloud.log" fi