go-haproxy icon indicating copy to clipboard operation
go-haproxy copied to clipboard

Issue #4 - Move to stub/mock based testing.

Open jesseward opened this issue 8 years ago • 0 comments

The currently library is strongly coupled HA-Proxy, meaning that in order to execute tests haproxy must be running locally. This change adds an interface (HAProxy) that allows us to then stub out the calls to RunCommand.

Note: If you're to go this route, README will need to be updated as the Info and Stats methods are no longer pointer receivers, but instead receiving the HAProxyClient as an argument. For example

client := HAProxyClient{Addr: "tcp://blah:64738"}
info, err := Info(client) {
    ...
}
...

Your method (or implementation) may vary. Though as @benjic mentioned, decoupling network services from your test cases are the way to go.

jesseward avatar May 08 '16 20:05 jesseward