server: add unit tests

Make test coverage >= 90%

#1019 
:-(
https://github.com/coreos/etcd/issues/1021