Skip to content
Closed
12 changes: 12 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''
}
}
}

Expand Down
1 change: 1 addition & 0 deletions build/integration/data/file_to_overwrite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BLABLABLA
6 changes: 3 additions & 3 deletions build/integration/features/bootstrap/BasicStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand All @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions build/integration/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
14 changes: 8 additions & 6 deletions build/integration/federation_features/federated.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions build/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=$?

Expand All @@ -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
Expand Down