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 utility methods and additional test drivers #1047

Merged
merged 4 commits into from
Jun 14, 2016
Merged

Conversation

tagomoris
Copy link
Member

When we want to write tests of 3rd party plugins, we need some more code for:

  • generating Fluent::EventTime easily
  • generating Fluent::Config::Element easily (required for owned plugins - parser, formatter, storage, buffer and others)
  • test drivers for owned plugins to support to
    • instantiate plugins
    • configure plugins
    • set logger, plugin id and override system configs

@tagomoris
Copy link
Member Author

Code of test drivers are not proven because there are not tests for each parsers/formatters.
I'll fix these drivers when I'll add tests for these.

if conf.is_a?(Fluent::Config::Element)
@config = conf
elsif conf.is_a?(Hash)
@config = Fluent::Config::Element.new(@section_name, "", Hash[conf.map{|k,v| [k.to_s, v]}])
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that last [] is needed.

-@config = Fluent::Config::Element.new(@section_name, "", Hash[conf.map{|k,v| [k.to_s, v]}])
+@config = Fluent::Config::Element.new(@section_name, "", Hash[conf.map{|k,v| [k.to_s, v]}], [])

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. I'll fix it.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@tagomoris tagomoris merged commit fee8d31 into master Jun 14, 2016
@tagomoris
Copy link
Member Author

Merged.

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.

2 participants