Refactoring code to remove duplicate code test.
Refactoring code to remove duplicate code test.

Signed-off-by: Samuele Resca <d0c6961b9a11a0b88b88e6afd6f16ccbfb33fbe1@ad.datcon.co.uk>
Signed-off-by: Samuele Resca <0b6a1938433bd49f39807083d0f7ece6f3db42dc@gmail.com>

etcd-io/etcd,etcd-io/etcd,etcd-io/etcd