Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-3205) Ignore ENOENT when cleaning up temporary test files #2733

Merged
merged 3 commits into from
Jun 24, 2024

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented Jun 14, 2024

Facter tests sometimes fail on JRuby with the following, even when using
the same seed:

$ bundle exec rspec --order random:22464 spec_integration
...
Errno::ENOENT:
  No such file or directory - /tmp/external_facts20240617-2780089-h18bte/XFZQDAMC_data.yaml
# ./spec_integration/facter_spec.rb:13:in `write_to_file'
# ./spec_integration/facter_spec.rb:752:in `block in <main>'

Since ENOENT means the entry doesn't exist, ignore it like puppet does[1].
However, we don't want to use rm_rf because that will ignore all
StandardErrors, not just ENOENT[2].

[1] https://github.com/puppetlabs/puppet/blob/8.6.0/spec/lib/puppet_spec/files.rb#L11-L15
[2] https://bugs.ruby-lang.org/issues/18784

Facter tests sometimes fail on JRuby with the following, even when using
the same seed:

    $ bundle exec rspec --order random:22464 spec_integration
    ...
    Errno::ENOENT:
      No such file or directory - /tmp/external_facts20240617-2780089-h18bte/XFZQDAMC_data.yaml
    # ./spec_integration/facter_spec.rb:13:in `write_to_file'
    # ./spec_integration/facter_spec.rb:752:in `block in <main>'

Since ENOENT means the entry doesn't exist, ignore it like puppet does[1].
However, we don't want to use `rm_rf` because that will ignore all
StandardErrors, not just ENOENT[2].

[1] https://github.com/puppetlabs/puppet/blob/8.6.0/spec/lib/puppet_spec/files.rb#L11-L15
[2] https://bugs.ruby-lang.org/issues/18784
@joshcooper joshcooper changed the title Fix write_to_file (FACT-3205) Ignore ENOENT when cleaning up temporary test files Jun 18, 2024
@joshcooper joshcooper marked this pull request as ready for review June 18, 2024 01:04
@joshcooper joshcooper requested a review from a team as a code owner June 18, 2024 01:04
@joshcooper joshcooper added the maintenance Maintenance chores are excluded from changelogs label Jun 18, 2024
@cthorn42
Copy link
Collaborator

For the commit, 69030d1, could we just include the removal of RSpec/MultipleMemoizedHelpers?

@cthorn42 cthorn42 merged commit 06c37a2 into puppetlabs:main Jun 24, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants