[QA][CLI] Add Cli Tests Coverage For Post Processing Service
Description
The post processing service is a crucial component of the OCIS system, responsible for managing unfinished uploads. However, the current test coverage for this service is limited, and there is a need to add more tests to ensure its stability and reliability. This article outlines the steps to add CLI tests coverage for the post processing service.
Using Post Processing Service
The post processing service can be used to manage unfinished uploads using the following commands:
List Upload Sessions
The ocis storage-users uploads sessions
command is used to list all the upload sessions. This command displays the space, upload ID, name, offset, size, executant, owner, expires, processing, scan date, and scan result for each upload session.
> ./ocis/bin/ocis storage-users uploads sessions
Sessions:
+--------------------------------------+--------------------------------------+--------------------------------+--------+--------+--------------------------------------+--------------------------------------+---------------------------+------------+----------------------+-------------+
| Space | Upload Id | Name | Offset | Size | Executant | Owner | Expires | Processing | Scan Date | Scan Result |
+--------------------------------------+--------------------------------------+--------------------------------+--------+--------+--------------------------------------+--------------------------------------+---------------------------+------------+----------------------+-------------+
| 7f2afb67-021a-4553-b711-7c91d294bcac | 42287076-699c-4857-8466-d6ee2b4cf531 | Screenshot from 2025-01-29 | 133251 | 133251 | 7f2afb67-021a-4553-b711-7c91d294bcac | 7f2afb67-021a-4553-b711-7c91d294bcac | 2025-04-29T12:23:11+05:45 | true | 0001-01-01T00:00:00Z | |
| | | 16-32-54.png | | | | | | | | |
| 7f2afb67-021a-4553-b711-7c91d294bcac | 804767f0-3a24-4c23-8e76-922aa731978e | Screenshot from 2025-02-05 | 38000 | 38000 | 7f2afb67-021a-4553-b711-7c91d294bcac | 7f2afb67-021a-4553-b711-7c91d294bcac | 2025-04-29T12:23:11+05:45 | true | 0001-01-01T00:00:00Z | |
| | | 13-01-43.png | | | | | | | | |
| 7f2afb67-021a-4553-b711-7c91d294bcac | b25c1983-cc0b-4281-93bb-b8ccc772a478 | Screenshot from 202501-17 | 226645 | 226645 | 7f2afb67-021a-4553-b711-7c91d294bcac | 7f2afb67-021a-4553-b711-7c91d294bcac | 2025-04-29T12:23:11+05:45 | true | 0001-01-01T00:00:00Z | |
| | | 11-42-49.png | | | | | | | | |
+--------------------------------------+--------------------------------------+--------------------------------+--------+--------+--------------------------------------+--------------------------------------+---------------------------+------------+----------------------+-------------+
Resume Specific Upload
The ocis postprocessing resume -u <upload_id>
command is used to resume a specific upload.
> ./ocis/bin/ocis postprocessing resume -u 1b403b5c-73b5-479d-a4f3-ba57d7e96a9c
Restart Post Processing for a Specific Upload
The ocis postprocessing resume -r -u <upload_id>
command is used to restart post processing for a specific upload.
> ./ocis/bin/ocis postprocessing resume -r -u 5032795f-86a9-44ca-9a88-7b0f288ed7fc
Resume All Uploads in a Specific Post Processing Step
The ocis postprocessing resume -s <step_name>
command is used to resume all uploads in a specific post processing step.
> ./ocis/bin/ocis postprocessing resume
> ./ocis/bin/ocis postprocessing resume -s "finished"
> ./ocis/bin/ocis postprocessing resume -s "virusscan"
How to Obtain Failed Upload
To obtain a failed upload, you can set the POSTPROCESSING_DELAY
environment variable and upload resources while restarting the OCIS service using the ocis-wrapper
. This will result in an unfinished upload.
Alternatively, you can use the following steps to obtain a failed upload:
- Set the
POSTPROCESSING_DELAY
environment variable. - Upload resources.
- Restart the OCIS service using the
ocis-wrapper
.
Test Coverage
The following test coverage is required for the post processing service:
Resume-Specific Failed Upload
- Test case: Resume a specific failed upload using the
ocis postprocessing resume -u <upload_id>
command. - Expected result: The upload should be resumed successfully.
Restart Post Processing for a Specific Upload
- Test case: Restart post processing for a specific upload using the
ocis postprocessing resume -r -u <upload_id>
command. - Expected result: The post processing should be restarted successfully.
Resume All Failed Uploads
- Test case: Resume all failed uploads using the
ocis postprocessing resume
command. - Expected result: All failed uploads should be resumed successfully.
Resume All Failed Uploads Which Are at Post Processing Step Finish
- Test case: Resume all failed uploads which are at post processing step finish using the
ocis postprocessing resume -s "finished"
command. - Expected result: All failed uploads are at post processing step finish should be resumed successfully.
Resume All Failed Uploads Which Are at Post Processing Step Virusscan
- Test case: Resume all failed uploads which are at post processing step virusscan using the
ocis postprocessing resume -s "virusscan"
command. - Expected result: All failed uploads which are at post processing step virusscan should be resumed successfully.
Q: What is the purpose of the post processing service?
A: The post processing service is responsible for managing unfinished uploads in the OCIS system. It ensures that uploads are processed correctly and efficiently.
Q: How do I list all the upload sessions using the post processing service?
A: You can use the ocis storage-users uploads sessions
command to list all the upload sessions. This command displays the space, upload ID, name, offset, size, executant, owner, expires, processing, scan date, and scan result for each upload session.
Q: How do I resume a specific upload using the post processing service?
A: You can use the ocis postprocessing resume -u <upload_id>
command to resume a specific upload. Replace <upload_id>
with the actual upload ID.
Q: How do I restart post processing for a specific upload using the post processing service?
A: You can use the ocis postprocessing resume -r -u <upload_id>
command to restart post processing for a specific upload. Replace <upload_id>
with the actual upload ID.
Q: How do I resume all uploads in a specific post processing step using the post processing service?
A: You can use the ocis postprocessing resume -s <step_name>
command to resume all uploads in a specific post processing step. Replace <step_name>
with the actual step name.
Q: How do I obtain a failed upload using the post processing service?
A: You can set the POSTPROCESSING_DELAY
environment variable and upload resources while restarting the OCIS service using the ocis-wrapper
. This will result in an unfinished upload.
Q: What is the expected result of the test cases for the post processing service?
A: The expected result of the test cases for the post processing service is that the uploads should be resumed successfully, and the post processing should be restarted correctly.
Q: Why is it important to add CLI tests coverage for the post processing service?
A: It is important to add CLI tests coverage for the post processing service to ensure its stability and reliability. This will help to identify and fix any issues that may arise during the processing of uploads.
Q: What are the benefits of adding CLI tests coverage for the post processing service?
A: The benefits of adding CLI tests coverage for the post processing service include:
- Improved stability and reliability of the post processing service
- Identification and fixing of issues that may arise during the processing of uploads
- Enhanced user experience through the provision of a reliable and efficient post processing service
Q: How can I implement the test cases for the post processing service?
A: You can implement the test cases for the post processing service by using a testing framework such as Jest or Mocha. You can write test cases for each of the scenarios outlined above and ensure that the expected results are achieved.
Q: What are the next steps after implementing the test cases the post processing service?
A: After implementing the test cases for the post processing service, you can:
- Run the test cases to ensure that they are working correctly
- Fix any issues that may arise during the testing process
- Deploy the updated post processing service to production
- Monitor the post processing service to ensure that it is working correctly and efficiently.