owncloud / testing

🔧 app for testing ownCloud
GNU Affero General Public License v3.0
3 stars 4 forks source link

Need ability to freeze uploads #6

Open PVince81 opened 6 years ago

PVince81 commented 6 years ago

This is needed to be able to test things like "job status" https://github.com/owncloud/core/pull/32414 and also the ability to test behavior in case of PHP timeouts.

PVince81 commented 6 years ago

might be doable by registering a storage wrapper which slows down or pauses stream operations. The storage wrapper would override fopen() and file_put_contents() and return a wrapped steam (or stream filter)

patrickjahns commented 6 years ago

This was the initial request for this ticket: https://github.com/owncloud/core/issues/32183

PVince81 commented 6 years ago

A bigger challenge I see here is not in the freezing but the unfreezing.

While it might be useful for local debugging to have sleep statements present and triggered in a storage wrapper, it becomes impractical for automated testing. In the latter case we'd need a mechanism to be able to kill these requests. It might be possible by closing the network connection on the client side but in some setups the process might continue running.

In scenarios where we want to test what happens after the delay when unfreezing, we'd need to replace the sleep statement with some kind of listener loop which waits for outside events (event queue??) that tells it to unfreeze. This would be needed for automated tests for scenarios like asynchronous PUT where we want to freeze the assembly job so we can query its status, but then unfreeze it so we can test the job status return code when the job actually finishes.