Skip to content

Conversation

nabim777
Copy link
Member

@nabim777 nabim777 commented Aug 15, 2025

Description

This PR adds a test for postprocessing command to resume on finished and virusscan steps defined failed uploads.

ocis postprocessing resume                # Resumes all uploads where postprocessing is finished, but upload is not finished.
ocis postprocessing resume -s "finished"  # Equivalent to the above.
ocis postprocessing resume -s "virusscan" # Resume all uploads currently in virusscan step.

For more information about this command 👉 click here

Related Issue

Motivation and Context

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@nabim777 nabim777 force-pushed the tests/post-processing-resume branch from da6ed82 to d9deb78 Compare August 18, 2025 04:24
@nabim777 nabim777 self-assigned this Aug 18, 2025
@nabim777 nabim777 force-pushed the tests/post-processing-resume branch 2 times, most recently from 2245bce to d1d300b Compare August 19, 2025 09:26
// $responseBody["message"] contains a message info with the array of output json of the upload sessions command
// Example Output: "INFO memory is not limited, skipping package=github.com/KimMachineGun/automemlimit/memlimit [{<output-json>}]"
// So, only extracting the array of output json from the message
\preg_match('/(\[.*\])/', $responseBody["message"], $matches);
return \json_decode($matches[1], null, 512, JSON_THROW_ON_ERROR);
\preg_match('/(\[.*?\])/', $responseBody["message"], $matches);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- \preg_match('/(\[.*\])/', $responseBody["message"], $matches);
+ \preg_match('/(\[.*?\])/', $responseBody["message"], $matches);

making regex non-greedy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but why was it required?

Copy link
Member Author

@nabim777 nabim777 Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not needed for current scenario, so I will leave it as is (no changes)

@nabim777 nabim777 marked this pull request as ready for review August 19, 2025 09:33
@nabim777 nabim777 force-pushed the tests/post-processing-resume branch from d1d300b to 087234c Compare August 19, 2025 09:41
@nabim777 nabim777 requested a review from Ashim-Stha August 22, 2025 03:41
@nabim777 nabim777 force-pushed the tests/post-processing-resume branch from 087234c to 418ddc0 Compare August 25, 2025 08:58
@nabim777 nabim777 force-pushed the tests/post-processing-resume branch from 418ddc0 to d6eab5f Compare August 25, 2025 08:59
Copy link

@@ -525,6 +525,38 @@ public function theAdministratorResumesOrRestartsUploadSessionOfFileUsingPostpro
$this->featureContext->setResponse(CliHelper::runCommand($body));
}

/**
* @When /^the administrator resumes all the uploads session using the post processing command$/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @When /^the administrator resumes all the uploads session using the post processing command$/
* @When the administrator resumes all the uploads session using the post processing command

Comment on lines +328 to +331
Scenario: resume virus file upload failed on virus scan step using postprocessing command
Given the following configs have been set:
| config | value |
| POSTPROCESSING_STEPS | delay,virusscan |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above scenario should cover this as well

Comment on lines +301 to +313
| POSTPROCESSING_STEPS | delay,virusscan |
| ANTIVIRUS_INFECTED_FILE_HANDLING | abort |
| POSTPROCESSING_DELAY | 10s |
And user "Alice" has created a new TUS resource in the space "Personal" with the following headers:
| Upload-Length | 10 |
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
| Tus-Resumable | 1.0.0 |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" via TUS inside of the space "Personal" using the WebDAV API
And user "Alice" has uploaded file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt"
And user "Alice" has uploaded file with content "uploaded content" to "file.txt"
And the administrator has waited for "1" seconds
And the administrator has stopped the server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this flow, the file upload doesn't fail on virusscan, it fails on delay step

@@ -245,3 +245,107 @@ Feature: List upload sessions via CLI command
When the administrator waits for "3" seconds
Then for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
And the content of file "file1.txt" for user "Alice" should be "uploaded content"


Scenario: resume all failed upload but not for unfinished upload using postprocessing command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finding it difficult to understand the title

Suggested change
Scenario: resume all failed upload but not for unfinished upload using postprocessing command
Scenario: resume all upload sessions containing unfinished upload using postprocessing command

And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator resumes all uploads session in finished step using post processing command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what constitutes a finished step? the test flow is same creating failed uploads

And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator resumes all the uploads session using the post processing command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When the administrator resumes all the uploads session using the post processing command
When the administrator resumes all the upload sessions using the postprocessing command

And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator resumes all uploads session in finished step using post processing command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When the administrator resumes all uploads session in finished step using post processing command
When the administrator resumes all upload sessions in finished step using postprocessing command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants