puppet-collectd icon indicating copy to clipboard operation
puppet-collectd copied to clipboard

mongodb plugin tests are possibly brittle

Open ffrank opened this issue 10 years ago • 3 comments

There was a short discussion of regex tests vs. fixtures in #371.

I still quite strongly disagree with @ghoneycutt's assertion that fixtures fix a problem with the data structures at hand.

If I understand you correctly, you fear that regex tests are too broad and don't take the structure of the template output into account. That is, a change to the template that would case invalid output due to broken XML structure would pass the tests.

I argue that this distinction is not the point of unit tests. If we want to make sure that certain inputs lead to output that is usable by collectd, we'd need to add some actual acceptance tests. It is out of the scope of unit testing IMO.

I propose to replace the checks in the current set of unit tests to make weaker assertions. I would also add an integration test to check the XML structure.

All that being said, thanks for being so thorough about testing, it really adds much value to your code contribution!

ffrank avatar Nov 17 '15 19:11 ffrank

Can we get more information, here? The latest modulesync added some foundation for acceptance testing.

jyaworski avatar Mar 05 '16 21:03 jyaworski

I will eventually go ahead and change the testing approach. This is a low priority, however.

ffrank avatar Mar 29 '16 16:03 ffrank

If we want to make sure that certain inputs lead to output that is usable by collectd, we'd need to add some actual acceptance tests. It is out of the scope of unit testing IMO.

I agree

juniorsysadmin avatar Dec 20 '16 12:12 juniorsysadmin