fix(sftp): make sure to delete last file when watch
and delete_on_finish
are enabled
#3037
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2435
Questions
I believe I have fixed the underlying issue, but I am not sure how to write an integration test to verify the fix. I have created a new integration test function with a
TODO
comment on where I got stuck. The questions I have around this are:watch
anddelete_on_finished
enabled, the use an SFTP client directly to inspect which files exist on the server to make sure they are all deleted after the pipeline runs. However, I'm not sure how to actually run the pipeline. Is too specific of a test to run usingintegration.StreamTests()
, and if not, could you point me in the right direction?newSFTPReaderFromParsed()
directly from the tests then useConnect()
, andReadBatch()
to interact with the plugin. However this plugin appears to be unusually structured in the way that it progresses through the input files. What it does is finds the first file inConnect()
and sets up the scanner for the file. InReadBatch()
, when the file is exhausted,ReadBatch()
returnsservice.ErrNotConnected
which will cause the engine to re-runConnect()
which advances to the next file. If the plugin only requiredConnect()
to be called once, I would be happy to drive the plugin directly in the tests, but because of the reconnection logic required, I was hesitant to reimplement the reconnection loop in the tests. Is there a utility somewhere that I can use from a test that implements the reconnect logic?