Skip to content

Commit

Permalink
Updated occ commands with maintenance commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranparajuli589 committed Oct 21, 2021
1 parent 6d21642 commit aa32836
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ config = {
"image": "owncloudci/php:7.4",
"pull": "always",
"commands": [
"php occ maintenance:singleuser --on",
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ encryption:encrypt-all --yes",
"php occ encryption:status",
"php occ maintenance:singleuser --off",
],
}],
"extraCommandsBeforeTestRun": [
Expand Down
19 changes: 14 additions & 5 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,19 +756,28 @@ public function theAdministratorHasDecryptedEverything():void {
$this->theCommandShouldHaveBeenSuccessful();
}

/**
* @When the administrator disables encryption using the occ command
*
* @return void
* @throws Exception
*/
public function theAdministratorDisablesEncryptionUsingTheOccCommand():void {
$this->invokingTheCommand("encryption:disable");
}

/**
* @When the administrator runs encryption decrypt all using the occ command
*
* @return void
*/
public function theAdministratorRunsEncryptionDecryptAllUsingTheOccCommand():void {
\system("./occ encryption:decrypt-all -c yes", $status);
\system("./occ maintenance:singleuser --on");
\system("./occ encryption:decrypt-all admin -c yes", $status);

$this->featureContext->setResultOfOccCommand(["code" => $status, "stdOut" => null, "stdErr" => null]);
if ($status !== 0) {
// if the above command fails make sure to turn off maintenance mode
\system("./occ maintenance:mode --off");
}
\system("./occ maintenance:singleuser --off");
\system("./occ maintenance:mode --off");
}

/**
Expand Down
10 changes: 3 additions & 7 deletions tests/acceptance/features/cliEncryption/encryption.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ Feature: encryption command
I want to encrypt-decrypt my data
So that users' resources are protected

# Background:
# Given the administrator has invoked occ command "encryption:enable"
# And the administrator has selected master key encryption type using the occ command


Scenario: view current encryption status
When the administrator invokes occ command "encryption:status"
Expand Down Expand Up @@ -42,15 +38,15 @@ Feature: encryption command

Scenario: it should not be possible to disable encryption without decrypting encrypted uploaded files
Given the administrator has uploaded file with content "uploaded content" to "/lorem.txt"
When the administrator invokes occ command "encryption:disable"
When the administrator disables encryption using the occ command
Then the command should have failed with exit code 1
And the command output should contain the text "The system still have encrypted files. Please decrypt them all before disabling encryption."


Scenario: it should be possible to disable encryption after decrypting all of the encrypted files
Given the administrator has uploaded file with content "uploaded content" to "/lorem.txt"
And the administrator has decrypted everything
And the administrator invokes occ command "encryption:disable"
When the administrator disables encryption using the occ command
Then the command should have been successful
And the command output should contain the text "Cleaned up config"
And the command output should contain the text "Encryption disabled"
Expand All @@ -70,6 +66,6 @@ Feature: encryption command
@skipOnOcV10 @issue-encryption-303
Scenario: it should not be possible to disable encryption even after decrypting all encrypted files if keys root has been changed
Given the administrator has decrypted everything
When the administrator invokes occ command "encryption:disable"
When the administrator disables encryption using the occ command
Then the command should have failed with exit code 1
And the command output should contain the text "The system still have encrypted files. Please decrypt them all before disabling encryption"

0 comments on commit aa32836

Please sign in to comment.