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

Add Plugin Log parser #912

Merged
merged 8 commits into from
Mar 28, 2020
Merged

Conversation

MichalRebisz
Copy link
Contributor

Added log parser plugin.

@@ -0,0 +1,70 @@
<%- | Optional $logfile = undef | -%>
Copy link
Member

Choose a reason for hiding this comment

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

This should have a spec test that shows how the template would be rendered given the default setting. Check out an example at https://github.com/ghoneycutt/puppet-module-bind/blob/master/spec/defines/acl_spec.rb#L22-L47

@@ -0,0 +1,5 @@
#https://wiki.opnfv.org/display/fastpath/Logparser+plugin+HLD
Copy link
Member

Choose a reason for hiding this comment

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

The types should have spec tests. Here's an example at https://github.com/sensu/sensu-puppet/blob/master/spec/type_aliases/backend_url_spec.rb

Basically you have two arrays, one of things that should pass and another of things that should fail.

Copy link
Contributor Author

@MichalRebisz MichalRebisz Feb 18, 2020

Choose a reason for hiding this comment

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

Should I use the same approach? Asking since I see it uses shoulda-matchers (If im not mistaken allow_value method is a part of it) Asking since if i'm to use the same approach to testing it I would have to add shoulda-matchers since I dont believe that puppet uses it right now.

Copy link
Member

@ghoneycutt ghoneycutt left a comment

Choose a reason for hiding this comment

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

Awesome work!

@bastelfreak bastelfreak added the enhancement New feature or request label Feb 16, 2020
@bastelfreak bastelfreak added the needs-work not ready to merge just yet label Feb 16, 2020
@bastelfreak bastelfreak changed the title Plugin Log parser Add Plugin Log parser Mar 4, 2020
it "Will create #{options[:plugin_conf_dir]}/06-log_parser.conf" do
is_expected.to contain_file('log_parser.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/06-log_parser.conf"
Copy link
Member

Choose a reason for hiding this comment

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

As @ghoneycutt mentioned, can you adda a test that verifies the content of the file? You could follow the approach he linked, or extend the acceptance tests to setup this plugin or provide a file as fixture and compare it. We do that here:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this what you had in mind?

@bastelfreak
Copy link
Member

The test looks good. Sadly something changed within the puppet 5 debian package or the image and it stopped working. This effects not only our collectd module but also all other modules we have. Hopefully Puppet can fix this during the next week.

@MichalRebisz
Copy link
Contributor Author

The test looks good. Sadly something changed within the puppet 5 debian package or the image and it stopped working. This effects not only our collectd module but also all other modules we have. Hopefully Puppet can fix this during the next week.

So do we have to wait for a fix for puppet or could we get this PR merged before that?

@bastelfreak
Copy link
Member

We need to wait until it's fixed.hopefully it's fixed soon

@bastelfreak bastelfreak reopened this Mar 28, 2020
@bastelfreak bastelfreak merged commit 2acec30 into voxpupuli:master Mar 28, 2020
@bastelfreak bastelfreak removed the needs-work not ready to merge just yet label Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants