Skip to content

[QA] Cli tests related to trash-bin #11248

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

Open
amrita-shrestha opened this issue Apr 17, 2025 · 0 comments
Open

[QA] Cli tests related to trash-bin #11248

amrita-shrestha opened this issue Apr 17, 2025 · 0 comments
Labels

Comments

@amrita-shrestha
Copy link
Contributor

amrita-shrestha commented Apr 17, 2025

Reference - #7936

Commands

ocis storage-users trash-bin <command>

COMMANDS:
   purge-expired  Purge expired trash-bin items
   list           Print a list of all trash-bin items of a space.
   restore-all    Restore all trash-bin items for a space.
   restore        Restore a trash-bin item by ID.

Details

  1. Make a GET request to: https://localhost:9200/graph/v1beta1/me/drives
  2. Use the value of owner.user.id from the response as the spaceid.
    Example: spaceid=349cd7c3-2fb8-49d4-823f-ac9792f57316

Example

# list trashbin 
./ocis/bin/ocis storage-users trash-bin list '349cd7c3-2fb8-49d4-823f-ac9792f57316'   
+--------------------------------------+--------------------------------+--------+----------------------+
|                itemID                |              path              |  type  |      delete at       |
+--------------------------------------+--------------------------------+--------+----------------------+
| 42869598-6626-48f8-90bc-49c5678c4c86 | /New folder                    | folder | 2025-04-17T10:12:49Z |
| 5e6b8ded-e71e-4a61-8c4a-4d6ba75f86f7 | /Screenshot from 2025-02-05    | file   | 2025-04-17T09:43:23Z |
|                                      | 13-01-43.png                   |        |                      |
+--------------------------------------+--------------------------------+--------+----------------------+
|                                                                                     total count: 2    |
+--------------------------------------+--------------------------------+--------+----------------------+


# restore specific item
./ocis/bin/ocis storage-users trash-bin restore '349cd7c3-2fb8-49d4-823f-ac9792f57316' '5e6b8ded-e71e-4a61-8c4a-4d6ba75f86f7'
itemID: '5e6b8ded-e71e-4a61-8c4a-4d6ba75f86f7', path: '/Screenshot from 2025-02-05 13-01-43.png', restored as './Screenshot from 2025-02-05 13-01-43.png'

# restore all item at once of specific project
./ocis/bin/ocis storage-users trash-bin restore-all -y '349cd7c3-2fb8-49d4-823f-ac9792f57316'
itemID: '42869598-6626-48f8-90bc-49c5678c4c86', path: '/New folder', restored as './New folder'
itemID: '5e6b8ded-e71e-4a61-8c4a-4d6ba75f86f7', path: '/Screenshot from 2025-02-05 13-01-43.png', restored as './Screenshot from 2025-02-05 13-01-43.png'

# purge expired
./ocis/bin/ocis storage-users trash-bin purge-expired  
to set expiration time use below env 
use STORAGE_USERS_PURGE_TRASH_BIN_USER_ID
use STORAGE_USERS_PURGE_TRASH_BIN_PERSONAL_DELETE_BEFORE= 1s
use STORAGE_USERS_PURGE_TRASH_BIN_PROJECT_DELETE_BEFORE =1s

Test coverage

  • list trashbin
    • list specific space deleted resource
  • restore specific item
    • personal
    • project
    • share
  • restore all item at once
    • personal
    • project
    • share
  • purge expired
    • Personal
    • spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant