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

Test driver fixes for error handling #1305

Merged
merged 13 commits into from
Nov 7, 2016

Conversation

tagomoris
Copy link
Member

This change follows #1302.
After #1302, I found that any errors in #write of output plugins are not raised in test case code like below:

assert_raise AnyErrors do
  d.run
    d.feed(events)
  end # events flushed and #write called - "AnyErrors" raised
end

Errors are shown on console, but we can't test it.
This change is to check all threads via thread plugin helper, and re-raise errors from these threads at the end of #run method. It shows all errors in all threads related with plugins explicitly as test results - so there's no need to show these errors on console.

Some changes are also included:

  • add an option to retry for flush errors even in plugin development: to emulate write operations 2 or more times over failures
  • use Process.clock_gettime instead of Time to work well even when timecop is used
  • raise TestTimedOut error for hard timeout to show problematic test cases clearly
  • change to wait post conditions after #run_actual, because output plugin test driver flushes and wait for completion of flushing in #run_actual

@tagomoris tagomoris added enhancement Feature request or improve operations v0.14 labels Nov 4, 2016
@tagomoris
Copy link
Member Author

@repeatedly could you review this change?
This is required for both of migrations of exec plugins and forward plugin.

@tagomoris
Copy link
Member Author

@repeatedly ping?


sleep_with_watching_threads = ->(){
if @instance.respond_to?(:_threads)
@instance._threads.values.each{|t| t.join(0) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happen with 0 limit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't wait for running threads with 0.

@repeatedly
Copy link
Member

LGTM

@tagomoris tagomoris merged commit ec738ad into master Nov 7, 2016
@tagomoris tagomoris deleted the raise-errors-from-threads-in-test-driver branch November 7, 2016 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or improve operations v0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants