Documentation ¶
Overview ¶
Package common contains common utilities and suites to be used in other tests
Index ¶
- func Build() error
- func ConsulMaker(port uint16, dir, prefix string) *exec.Cmd
- func EtcdMaker(port uint16, dir, prefix string) *exec.Cmd
- func ExitStatus(err error) int
- type Cmd
- type Suite
- func (s *Suite) DoRequest(method, url string, expectedRespCode int, postBodyStruct interface{}, ...) *http.Response
- func (s *Suite) Messager(prefix string) func(...interface{}) string
- func (s *Suite) PrefixKey(key string) string
- func (s *Suite) SetupSuite()
- func (s *Suite) SetupTest()
- func (s *Suite) TearDownSuite()
- func (s *Suite) TearDownTest()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsulMaker ¶
ConsulMaker will create an exec.Cmd to run consul with the given paramaters
func ExitStatus ¶
ExitStatus tries to extract an exit status code from an error.
Types ¶
type Cmd ¶
Cmd wraps an exec.Cmd with monitoring and easy access to output.
func (*Cmd) ExitStatus ¶
ExitStatus returns the exit status code and error for a command. If the command is still running or in the process of being shut down, the exit code will be 0 and the returned error will be non-nil.
type Suite ¶
type Suite struct { suite.Suite KVDir string KVPrefix string KVPort uint16 KVURL string KV kv.KV KVCmd *exec.Cmd KVCmdMaker func(uint16, string, string) *exec.Cmd TestPrefix string }
Suite sets up a general test suite with setup/teardown.
func (*Suite) DoRequest ¶
func (s *Suite) DoRequest(method, url string, expectedRespCode int, postBodyStruct interface{}, respBody interface{}) *http.Response
DoRequest is a convenience method for making an http request and doing basic handling of the response.
func (*Suite) TearDownSuite ¶
func (s *Suite) TearDownSuite()
TearDownSuite stops the kv instance and removes all data.