Ignore intermittent test teardown error

Occasionally when the `isolated` tests run in CI, this error is seen:

```
inspec-reporter-html2::when run on a basic profile#test_0002_should produce valid HTML:
Errno::ENOENT: No such file or directory @ apply2files - /tmp/temp20200625-1802-2izu7e.html
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:775:in `remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:562:in `block in rm'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:561:in `each'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:561:in `rm'
    lib/plugins/inspec-reporter-html2/test/functional/inspec_reporter_html2_test.rb:9:in `teardown'
```

It should be OK to ignore the failure to delete the test file - the issue doesn't reproduce on laptops, and CI uses clean VMs each time.

Signed-off-by: James Stocks <jstocks@chef.io>
This commit is contained in:
James Stocks 2020-06-25 15:24:27 +01:00
parent 41b99e4e45
commit d94d56c4b9

View file

@ -6,7 +6,8 @@ describe "inspec-reporter-html2" do
let(:output_file) { f = Tempfile.new(["temp", ".html"]); f.close; f.path }
def teardown
FileUtils.rm(output_file)
# Use force because the deletion may occasionally fail in parallel CI
FileUtils.rm_f(output_file)
end
describe "when run on a basic profile" do