Documentation ¶
Index ¶
- func Get(t *testing.T, actual []byte) []byte
- type TestServer
- func (s *TestServer) AddCheck(t *testing.T, id string, name string, serviceID string, ...)
- func (s *TestServer) AddService(t *testing.T, name string, tags []string)
- func (s *TestServer) Client() *http.Client
- func (s *TestServer) GetConsulNodeName() string
- func (s *TestServer) RequireOK(t *testing.T, resp *http.Response) error
- func (s *TestServer) Stop()
- func (s *TestServer) Url(t *testing.T, path string) string
- func (s *TestServer) Wrap(t *testing.T) *WrappedTestServer
- type WrappableTestServer
- type WrappedTestServer
- func (w *WrappedTestServer) AddCheck(id string, name string, serviceID string, status checks.HealthStatus)
- func (w *WrappedTestServer) AddService(name string, tags []string)
- func (w *WrappedTestServer) Client() *http.Client
- func (w *WrappedTestServer) GetConsulNodeName() string
- func (w *WrappedTestServer) RequireOK(resp *http.Response) error
- func (w *WrappedTestServer) Stop()
- func (w *WrappedTestServer) Url(path string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TestServer ¶
type TestServer struct { spi.RunningServer // contains filtered or unexported fields }
TestServer represents a test Consulate server.
func (*TestServer) AddCheck ¶
func (s *TestServer) AddCheck(t *testing.T, id string, name string, serviceID string, status checks.HealthStatus)
AddCheck adds a check to the test Consul server.
func (*TestServer) AddService ¶
func (s *TestServer) AddService(t *testing.T, name string, tags []string)
AddService adds a service to the test Consul server.
func (*TestServer) Client ¶
func (s *TestServer) Client() *http.Client
Client returns the http.Client used to communicate with the test Consulate server.
func (*TestServer) GetConsulNodeName ¶
func (s *TestServer) GetConsulNodeName() string
GetConsulNodeName returns the test Consul server's node name.
func (*TestServer) RequireOK ¶
RequireOK checks that the status code of the specified http.Response is 200.
func (*TestServer) Url ¶
func (s *TestServer) Url(t *testing.T, path string) string
Url appends the specified path to the base url used to communicate with the test Consulate server.
func (*TestServer) Wrap ¶
func (s *TestServer) Wrap(t *testing.T) *WrappedTestServer
Wrap combines the specified testing.T with the current TestServer into a WrappedTestServer which simplifies test code.
type WrappableTestServer ¶
type WrappableTestServer struct {
TestServer
}
WrappableTestServer represents a test Consulate server that can wrap testing.T, simplifying the usage in test code.
func NewTestServer ¶
func NewTestServer(t *testing.T) (*WrappableTestServer, error)
NewTestServer creates a new test Consulate server.
type WrappedTestServer ¶
type WrappedTestServer struct {
// contains filtered or unexported fields
}
WrappedTestServer represents the combination of a test Consulate server and testing.T.
func (*WrappedTestServer) AddCheck ¶
func (w *WrappedTestServer) AddCheck(id string, name string, serviceID string, status checks.HealthStatus)
AddCheck adds a check to the test Consul server.
func (*WrappedTestServer) AddService ¶
func (w *WrappedTestServer) AddService(name string, tags []string)
AddService adds a service to the test Consul server.
func (*WrappedTestServer) Client ¶
func (w *WrappedTestServer) Client() *http.Client
Client returns the http.Client used to communicate with the test Consulate server.
func (*WrappedTestServer) GetConsulNodeName ¶
func (w *WrappedTestServer) GetConsulNodeName() string
GetConsulNodeName returns the test Consul server's node name.
func (*WrappedTestServer) RequireOK ¶
func (w *WrappedTestServer) RequireOK(resp *http.Response) error
RequireOK checks that the status code of the specified http.Response is 200.
func (*WrappedTestServer) Stop ¶
func (w *WrappedTestServer) Stop()
Stop terminates the current RunningServer.
func (*WrappedTestServer) Url ¶
func (w *WrappedTestServer) Url(path string) string
Url appends the specified path to the base url used to communicate with the test Consulate server.