Tuesday, August 15, 2006

Test Driven Systems Administration

I wrote this in 2005. It was lost with my server. Thanks to Ade for the cached copy!

I have been thinking about how to apply Agile to the field of Systems Administration for a while now. I haven't been thinking too hard, mind you; but I have been thinking.

I googled, and found this and this, but nothing that really provided any great insight.

So I decided that a good starting place would be testing. Not monitoring, but testing. I had intended to play with Ruby or Python and extend their test frameworks so I could make assertions about the operating system, e.g. asserting that a process was bound to a socket, or that a server responded correctly. This week, I was asked to work on a project doing some migrations of servers, so it was a nice opportunity to test the theory out.

All the servers had Perl installed, so I chose Test::More as a test framework - again it was installed everywhere, and I didn't need much. So then it was simply:

ok(connect_host($ip,$port)==0,""can_connect_to_foo01"");

and it was good. connect_host is a subroutine to connect to a given host and TCP port using IO::Socket. So now I had tests to make sure that the services were available on the correct IP address. Will definitely try and expand on this.