naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
153 stars 63 forks source link

Improve tests for macros #56

Closed pengi closed 8 years ago

pengi commented 10 years ago

The macro library needs a total rewrite sooner or later. The mkstr isn't really thread safe (with static variables in the method to temporary store variables), and it isn't that performance efficient to resolve an array of all possible macros, if some are quite performance heavy (listing groups, counting services, counting rocks in the entire beach, and so).

To be able to rewrite the macro library, we first need to improve the test suite.

So each macro should be a part of at least one test that extracts unique information of a mocked object.

Some tests is already available in the macro test suite. Create another test suite just to test the different macros, not the explicit escaping, is preffered.

pengi commented 10 years ago

I've looked at that macro resolution code long enough and though that something really needs to be done, but hasn't been able to fix it due to the lack of tests.

I might start with the test suite sometime soon, but there are lot of macros, and it should be a quite easy task for someone to actually just modify the test suite and add tests, and apply as pull requests.

A great issue to get started with naemon development :)

catharsis commented 8 years ago

I'm closing this since it has stagnated. While more tests would be nice, I don't think it makes sense to track the issue of writing them separately. I'd rather we build a suite of regression tests if/when we get around to giving the macro subsystem its much-needed overhaul.