CiscoCloud / distributive

Unit testing for the cloud
Apache License 2.0
147 stars 20 forks source link

Add check to resolve host with specified nameserver #68

Open soellman opened 9 years ago

soellman commented 9 years ago

The use case here is to check and see if the nameserver is resolving what we'd expect instead of whether a name can be resolved on the host.

langston-barrett commented 9 years ago

This looks easy to do. I'm planning to implement this using a dns library, rather than a call to nslookup or some such. An example application that does exactly what this check needs is available here.

soellman commented 9 years ago

Awesome. I'd be happy do this to too if you like.

langston-barrett commented 9 years ago

@soellman Already working on it :) I could use a little help on the template functions, as I'm less sure where to start with those. I'll push my branch on this once I have an intial setup, and maybe you could do the same with templating functions, if you have the time?

soellman commented 9 years ago

Sure, no problem. I'll work on it tomorrow. -o

langston-barrett commented 9 years ago

@soellman This check is now in the branch check/dns-arecord. It currently only supports A records. I'll let you give it a whirl before merging, in case it doesn't fit your use case or doesn't work as you might expect.

"aRecord"

soellman commented 9 years ago

I'd vote for splitting this up a bit. Maybe instead of aRecord, you could have:

resolveDNS which takes name, nameserver (optional?), type (default A?) - like the "host" check but with args resolveDNSMatches which takes name, value, nameserver (optional?), type (default A?)

For my case, I don't actually want to know what the result was, just that I got one. This might be used for testing a forwarding dns server with a well known name (like google.com).

And to make it simple for now, most people will only use the A record anyways so support for more record types could get filled out if/when people request them.

I tested the branch and the simple matching case works great :) -o