# Logstash plugin unit tests, strip output and input blocks of config

**URL:** <https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170>\
**Category:** Logstash\
**Created:** [June 20, 2017, 10:52pm UTC](https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170 "2017-06-20T22:52:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Conall\_Prendergast](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Conall\_Prendergast](https://discuss.elastic.co/u/Conall_Prendergast)\
**Post date:** [June 20, 2017, 10:52pm UTC](https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170/1 "2017-06-20T22:52:36Z")

</div>

In my unit tests for my custom logstash plugin, I load in a config file that has input, filter, and output blocks, as normal.

Is there an easy way to somehow load only the filter section of this file, perhaps using the LogStashConfigParser class or similar?

The reason for this is that I wish to be able to load the tests without having to have the input and output plugins installed on the test machine.

Also, I cannot split this file into 3 separate files.

Thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 21, 2017, 5:35am UTC](https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170/2 "2017-06-21T05:35:41Z")

</div>

> In my unit tests for my custom logstash plugin, I load in a config file that has input, filter, and output blocks, as normal.

That doesn't quite sound like unit tests, but okay.

> Also, I cannot split this file into 3 separate files.

Why not?

---

<div class="post-metadata">

**Author:** ![Conall\_Prendergast](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Conall\_Prendergast](https://discuss.elastic.co/u/Conall_Prendergast)\
**Post date:** [June 21, 2017, 8:28am UTC](https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170/3 "2017-06-21T08:28:31Z")

</div>

You are correct in saying these are not unit tests, I suppose they are more like integration tests.  
I am testing a conf file that I will eventually ship as part of an RPM, and this contains some important version information in it's header that is automatically generated on commit.  
Therefor only one file can exist in source control.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 19, 2017, 8:35am UTC](https://discuss.elastic.co/t/logstash-plugin-unit-tests-strip-output-and-input-blocks-of-config/90170/4 "2017-07-19T08:35:28Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
