Skip to content

Commit aa32836

Browse files
Updated occ commands with maintenance commands
1 parent 6d21642 commit aa32836

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

.drone.star

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ config = {
2626
"image": "owncloudci/php:7.4",
2727
"pull": "always",
2828
"commands": [
29+
"php occ maintenance:singleuser --on",
2930
"php occ encryption:enable",
3031
"php occ encryption:select-encryption-type masterkey --yes",
32+
"php occ encryption:encrypt-all --yes",
3133
"php occ encryption:status",
34+
"php occ maintenance:singleuser --off",
3235
],
3336
}],
3437
"extraCommandsBeforeTestRun": [

tests/acceptance/features/bootstrap/OccContext.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,28 @@ public function theAdministratorHasDecryptedEverything():void {
756756
$this->theCommandShouldHaveBeenSuccessful();
757757
}
758758

759+
/**
760+
* @When the administrator disables encryption using the occ command
761+
*
762+
* @return void
763+
* @throws Exception
764+
*/
765+
public function theAdministratorDisablesEncryptionUsingTheOccCommand():void {
766+
$this->invokingTheCommand("encryption:disable");
767+
}
768+
759769
/**
760770
* @When the administrator runs encryption decrypt all using the occ command
761771
*
762772
* @return void
763773
*/
764774
public function theAdministratorRunsEncryptionDecryptAllUsingTheOccCommand():void {
765-
\system("./occ encryption:decrypt-all -c yes", $status);
775+
\system("./occ maintenance:singleuser --on");
776+
\system("./occ encryption:decrypt-all admin -c yes", $status);
766777

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

774783
/**

tests/acceptance/features/cliEncryption/encryption.feature

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ Feature: encryption command
44
I want to encrypt-decrypt my data
55
So that users' resources are protected
66

7-
# Background:
8-
# Given the administrator has invoked occ command "encryption:enable"
9-
# And the administrator has selected master key encryption type using the occ command
10-
117

128
Scenario: view current encryption status
139
When the administrator invokes occ command "encryption:status"
@@ -42,15 +38,15 @@ Feature: encryption command
4238

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

4945

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

0 commit comments

Comments
 (0)