Open colinsurprenant opened 7 years ago
I'm wondering how this compares to having a new logstash command that runs list_of_plugin_names.each {|p_name| LogStash::Plugin.lookup.(p_name)}
which was, I believe, proposed by @jsvd ? The nice thing about that is that we wouldn't need to maintain the sample-config
stuff.
@andrewvc The difference is that this proposal is a real out-of-the-box test which calls logstash on a real config on a generated package. it is much more closer to what happens when a user spins logstash so a good way to validate the integrity of a package related to its actual bundled plugins.
My 2c:
I personally like that we load these plugins like the user would (using bin/logstash
) when using the mega config. As such this would make it a real integration test which is the spirit of the RATS test.
One concern is about the overhead of maintaining a config field in the plugins-metadata.json
and keeping it in sync, but we're only using the bare minimum config to trigger the load, so this shouldn't be a big deal.
Thinking further, this kind of test can have a nice side effect. We can catch any unintentional backward incompatibility issues with the configs.
OK, I'm +1 on this approach.
One concern is about the overhead of maintaining a config field in the plugins-metadata.json and keeping it in sync, but we're only using the bare minimum config to trigger the load, so this shouldn't be a big deal.
Agree, also plugins required settings is not something we change often and it won't cause "silent" upstream problems since any mismatch will result in the test failing, in that respect it is safe. But yes, this new sample-config: "..."
field might need to be updated from time to time if we change a plugin config required settings.
This is a quick win, regardless of using .lookup or -t, with the added benefit the latter runs the initialize
method of each plugin.
As long as we don't have plugins that instantiate resources that can create conflicts in their constructor (and they shouldn't, that's what register
is for), it should be hassle free.
+1
Relates to #7627 - [meta] streamline and harmonize plugins with jars build and publish processes
This configuration contains all the default plugins
and can be used with this command to test the loading/initialization and dependencies loading (including jar files) with
If all plugins are successfully loaded, then logstash exits with a shell exit status of
0
and this outputOtherwise it will exit with and error log and a shell exit status of 1
, for example by uncommenting the
dead_letter_queue` input in the above configProposal
sample-config: "..."
which will contain a string of a syntax-valid plugin config, basically the plugin configs that are required as above in the default plugins config file.logstash/rakelib/plugins-metadata.json
for the"default-plugins": true
and using thesample-config: "..."
field.bin/logstash -t -f default-plugins.conf
and check for exit statusNote: the only tricky config of all default plugins is with the
lumberjack
input andcollectd
codec which actually verifies the existence of the configured files. We can decide how to deal with it, but for now I just tricked it with a file I know is part of the package :)