Testing A Production DNS Re-point
We recently consolidated a number of websites used by one of our brands back down to a sensible number (sensible being one). Which, while only a single action point on an email, turned out to be a large amount of DNS and apache vhost wrangling. In order to give myself a safety net, and an easy to check todo list, I decided to invest ten minutes in writing a small test script.
Despite all my best intentions and experimenting with testing DNS with Cucumber and RSpec when the issue came up for real, and on a short deadline, I fell back to old habits and reached for perl. Net::DNS is an excellently documented module and the little utility modules like File::Slurp and URI::Title are perfect for quick tasks like this. The full test_dns_repoints.pl code, which is only 47 lines is something I can see myself using again and again as we repeat this kind of work.
It’s amazing how much a little effort can gain you when it comes to testing your infrastructure. Having that safety net, especially when you’re a one man team, is a very reassuring feeling and it’s one I’m trying to introduce in to more areas of even one off jobs.