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

Fix test race condition. #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

voxik
Copy link

@voxik voxik commented Apr 27, 2020

The test suite randomly fails with errors such as:

  1) Failure:
AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]:
Expected: Comments
  Actual: nil

This happens when test_namespaced* test cases are executed earlier
than the remaining test cases, because they are defining
view_namespace but not cleaning up afterwards.

The test suite randomly fails with errors such as:

~~~
  1) Failure:
AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]:
Expected: Comments
  Actual: nil
~~~

This happens when `test_namespaced*` test cases are executed earlier
than the remaining test cases, because they are defining
`view_namespace` but not cleaning up afterwards.
@voxik
Copy link
Author

voxik commented Apr 27, 2020

This can be reproduced by running test suite as:

$ ruby -Ilib -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'

I am bit surprised, that this probably never happened when running the test suite via Rake.

@voxik
Copy link
Author

voxik commented Apr 27, 2020

The CI error does not seem to be specific to this PR.

@voxik
Copy link
Author

voxik commented Apr 27, 2020

Also, it seems that this issue started to appear since testing against Ruby 2.7. Not sure what should be different, except Minitest version (which could influence test order).

@boutil
Copy link

boutil commented Sep 26, 2020

This seems to fix random test failures, seen on Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants