Fix the no file or dir CI issue that temfile might be loosing its ref.#29
Merged
mashhurs merged 2 commits intologstash-plugins:mainfrom Oct 29, 2025
Merged
Conversation
donoghuc
approved these changes
Oct 29, 2025
Contributor
donoghuc
left a comment
There was a problem hiding this comment.
I think this is certainly the bug! Arguably it would be more "core" rspec to use around
around(:each) do |example|
Tempfile.create('logstash-spec-output-csv') do |f|
@tmpfile = f
example.run
end
end
let(:tmpfile_path) { @tmpfile.path } That would trigger all the Tempfile cleanup in its native block form.
But i dont think its necessarily worth doing that given what you have here fixes the bug and is readable :)
|
|
||
| subject { described_class.new(options) } | ||
|
|
||
| let(:tmpfile) { Tempfile.new('logstash-spec-output-csv').path } |
Contributor
There was a problem hiding this comment.
Ah, yeah looks like the bug was that the a new Tempfile was created (side effect of actually making the file) but there was no reference to it because this was simply reference to the path. So it was free to be cleaned up. Keeping the reference to the Tempfile object should solve it.
Refine the comment for better understanding. Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 the
Errno::ENOENT: No such file or dirirectoryerror: https://app.travis-ci.com/github/logstash-plugins/logstash-output-csv/jobs/635452763#L650