dashingrocket / simplecov-cobertura

Ruby SimpleCov Cobertura Formatter
Apache License 2.0
52 stars 38 forks source link

1 error in tests #27

Open micwoj92 opened 7 months ago

micwoj92 commented 7 months ago

Hello, I'm trying to run the test suite, but I run into 1 test error. ruby 3.0.6 nokogiri 1.13.9

Output when running rake:

Loaded suite /usr/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/rake_test_loader
Started
Coverage report generated for Unit Tests to /home/micwoj92/Documents/pkg/fog/simplecov-cobertura/tmp/coverage.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
E
==============================================================================================================================================================================================================================================
Error: test_format_dtd_validates(CoberturaFormatterTest): NoMethodError: undefined method `validate' for nil:NilClass
/home/micwoj92/Documents/pkg/fog/simplecov-cobertura/test/simplecov-cobertura_test.rb:56:in `test_format_dtd_validates'
     53:     xml = @formatter.format(@result)
     54:     options = Nokogiri::XML::ParseOptions::DTDLOAD
     55:     doc = Nokogiri::XML::Document.parse(xml, nil, nil, options)
  => 56:     assert_empty doc.external_subset.validate(doc)
     57:   end
     58: 
     59:   def test_no_groups
==============================================================================================================================================================================================================================================
Coverage report generated for Unit Tests to /home/micwoj92/Documents/pkg/fog/simplecov-cobertura/tmp/cobertura.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
|Coverage report generated for Unit Tests to /home/micwoj92/Documents/pkg/fog/simplecov-cobertura/tmp/coverage.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
/Coverage report generated for Unit Tests to /home/micwoj92/Documents/pkg/fog/simplecov-cobertura/tmp/coverage.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
-Coverage report generated for Unit Tests to /home/micwoj92/Documents/pkg/fog/simplecov-cobertura/tmp/coverage.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
\Coverage report generated for Unit Tests to /tmp/tmp/coverage.xml. 6 / 7 LOC (85.71%) covered; 3 / 6 BC (50.00%) covered
Finished in 0.137903972 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7 tests, 66 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
85.7143% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
50.76 tests/s, 478.59 assertions/s
rake aborted!
Command failed with status (1)

Tasks: TOP => default => test
(See full trace by running task with --trace)
okuramasafumi commented 6 months ago

I also encounter this error.

https://www.xmlvalidation.com/

I noticed that with this online validation tool, it cannot process the generated output when DTD check is enabled. So maybe it really has some issue, not only about testing.

jessebs commented 4 months ago

I get a generic error with the xmlvalidation.com link shared above - it's unclear if that has anything to do with the generated XML vs an internal error.

https://www.truugo.com/xml_validator/ does indicate that the xml generated by the failing test validates correctly.

jessebs commented 4 months ago

xmlib2 appears to have a problem downloading the dtd.

> xmllint coverage.xml --loaddtd --valid
....
error : Unknown IO error
coverage.xml:2: warning: failed to load external entity "http://cobertura.sourceforge.net/xml/coverage-04.dtd
....

Converting to https does not resolve it. Curl doesnt give any indication that things are strange.

Downloading the dtd and replacing the url with the relative path in the xml file gets rid of the error.

This indicates that there isn't a problem with the XML being generated but instead with the way the dtd file is being retrieved.

investigation continuing...

jessebs commented 4 months ago

My guess is that this is tied to OS updates since it last worked in the build environment. I created a ticket with gnome - lets see if it goes anywhere.

I filed: https://gitlab.gnome.org/GNOME/libxml2/-/issues/693

jessebs commented 4 months ago

Actually, it appears to do with an HTTPS redirect. http://cobertura.sourceforge.net/xml/coverage-04.dtd redirects to https.

https://gitlab.gnome.org/GNOME/libxml2/-/issues/160

jessebs commented 4 months ago

..and a nokogiri bug to track it:

https://github.com/sparklemotion/nokogiri/issues/3132