Yelp / nerve-tools

Tools for configuring SmartStack's Nerve based on local sources
Apache License 2.0
3 stars 12 forks source link

Improve testing tooling #60

Open colinschoen opened 5 years ago

colinschoen commented 5 years ago

It is difficult to write integration tests against nerve-tools and specifically the configure_nerve executable. nerve-tools uses paasta-tools in order to determine which services are running on the host. paasta-tools has several other dependencies, one being marathon which it communicates to over HTTP.

We have written a fake configure_nerve for use as a fixture in acceptance tests. As nerve has grows in complexity, this fake also grows and lots of logic is duplicated.

It would be great if nerve-tools provided testing tools to allow injecting the desired services from which the nerve-config is written, for use in consumers' testing environment.

solarkennedy commented 5 years ago

Does it have to be an integration test? Why not just mock whatever call at whatever boundary you want to test?

None of the configure_nerve things in paasta communicate to marathon. They only talk to mesos on 5051 and things on disk.

I don't think we need much more testing tools, I think all we needs is a couple of good fixtures for the json that mesos gives back at you.

colinschoen commented 5 years ago

Whoops, yes mesos not marathon.

paasta-tools also reads from files places like PUPPET_SERVICE_DIR = '/etc/nerve/puppet_services.d'

Yes, I think just a few testing fixtures exposed by nerve-tools that make it easy for folks wanting to test against the output of configure_nerve would help to reduce the amount of work to write a fake or mock out multiple portions of paasta-tools.

colinschoen commented 5 years ago

It looks like directly invoking generate_configuration in a fixture might actually be sufficient and reduce what needs to be mocked. I'll give this a go first.

colinschoen commented 5 years ago

@solarkennedy What are your thoughts of publishing nerve-tools to pypi? This would make importing it for testing much easier.

solarkennedy commented 5 years ago

Sure