Skip to content

Commit 1bcb8e4

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

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
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: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,27 @@ 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 {
775+
\system("./occ maintenance:singleuser --on");
765776
\system("./occ encryption:decrypt-all -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");
772780
}
773781

774782
/**

tests/acceptance/features/cliEncryption/encryption.feature

Lines changed: 14 additions & 18 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"
@@ -28,6 +24,18 @@ Feature: encryption command
2824
And the command output should contain the text "Current key storage root: default storage location (data/)"
2925

3026

27+
Scenario: it should be possible to disable encryption after decrypting all of the encrypted files
28+
Given the administrator has uploaded file with content "uploaded content" to "/lorem.txt"
29+
And the administrator has decrypted everything
30+
When the administrator disables encryption using the occ command
31+
Then the command should have been successful
32+
And the command output should contain the text "Cleaned up config"
33+
And the command output should contain the text "Encryption disabled"
34+
When the administrator invokes occ command "encryption:status"
35+
Then the command should have been successful
36+
And the command output should contain the text "enabled: false"
37+
38+
3139
Scenario: data file contents should be encrypted
3240
Given user "Alice" has been created with default attributes and without skeleton files
3341
When user "Alice" uploads file with content "file to upload" to "/fileToUpload.txt" using the WebDAV API
@@ -42,23 +50,11 @@ Feature: encryption command
4250

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

4957

50-
Scenario: it should be possible to disable encryption after decrypting all of the encrypted files
51-
Given the administrator has uploaded file with content "uploaded content" to "/lorem.txt"
52-
And the administrator has decrypted everything
53-
And the administrator invokes occ command "encryption:disable"
54-
Then the command should have been successful
55-
And the command output should contain the text "Cleaned up config"
56-
And the command output should contain the text "Encryption disabled"
57-
When the administrator invokes occ command "encryption:status"
58-
Then the command should have been successful
59-
And the command output should contain the text "enabled: false"
60-
61-
6258
Scenario: move encryption keys to a different folder
6359
When the administrator invokes occ command "encryption:change-key-storage-root owncloud-keys"
6460
Then the command should have been successful
@@ -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)