Skip to content

[tests-only][full-ci] Add tests related to purge expired trash resources #11353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/acceptance/bootstrap/CliContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,4 +894,17 @@ public function theAdministratorRestoresTheTrashedResourcesOfSpaceOwnedByUser(
];
$this->featureContext->setResponse(CliHelper::runCommand($body));
}

/**
* @When the administrator purges the expired trash resources
*
* @return void
* @throws GuzzleException
*/
public function theAdministratorPurgesTheExpiredTrashResources(): void {
$body = [
"command" => "storage-users trash-bin purge-expired"
];
$this->featureContext->setResponse(CliHelper::runCommand($body));
}
}
44 changes: 44 additions & 0 deletions tests/acceptance/features/cliCommands/trashBin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,47 @@ Feature: trashbin
| resource | type |
| /testfile.txt | file |
| /folder-to-delete | folder |


Scenario: purge expired trashed resources of Personal space
Given the following configs have been set:
| config | value |
| STORAGE_USERS_PURGE_TRASH_BIN_PERSONAL_DELETE_BEFORE | 1s |
And using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created the following folders
| path |
| folder-to-delete |
And user "Alice" has deleted folder "/folder-to-delete"
And user "Alice" has created a space "Newspace" with the default quota using the Graph API
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
And user "Alice" has removed the file "text.txt" from space "Newspace"
And the system waits for "1" seconds
When the administrator purges the expired trash resources
Then there should be no trashed resources of space "Personal" owned by user "Alice"
And there should be "1" trashed resources of space "Newspace" owned by user "Alice":
| resource | type |
| /text.txt | file |


Scenario: purge expired trashed resources of project space
Given the following configs have been set:
| config | value |
| STORAGE_USERS_PURGE_TRASH_BIN_PROJECT_DELETE_BEFORE | 1s |
And using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created the following folders
| path |
| folder-to-delete |
And user "Alice" has deleted folder "/folder-to-delete"
And user "Alice" has created a space "Newspace" with the default quota using the Graph API
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
And user "Alice" has removed the file "text.txt" from space "Newspace"
And the system waits for "1" seconds
When the administrator purges the expired trash resources
Then there should be no trashed resources of space "Newspace" owned by user "Alice"
And there should be "1" trashed resources of space "Personal" owned by user "Alice":
| resource | type |
| /folder-to-delete | folder |