Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElasticsearchTestServer ¶
type ElasticsearchTestServer struct {
// contains filtered or unexported fields
}
ElasticsearchTestServer is a single node elastic-search cluster running inside docker. use NewElasticsearchTestServer to instantiate the server
func NewElasticsearchTestServer ¶
func NewElasticsearchTestServer() *ElasticsearchTestServer
NewElasticsearchTestServer creates a new instance of elasticsearch test server. It runs a single node elasticsearch cluster in docker, exposing the REST API over a random ephemeral port. OR if the environment variable ES_TEST_SERVER_URL is set, it acts as a dumb proxy to it. The idea is to be able to easily run integration tests in local environments, while also being able to leverage a running ES intance for testing (for instance in CI pipelines) Make sure to call server.Close() once you're done, otherwise the docker container may be left running indefinitely in the background.
func (*ElasticsearchTestServer) Close ¶
func (srv *ElasticsearchTestServer) Close() error
func (*ElasticsearchTestServer) NewClient ¶
func (srv *ElasticsearchTestServer) NewClient() (*elasticsearch.Client, error)
NewClient returns an elasticsearch client for the test server Calling this method issues a DELETE /_all call to the elasticsearch server, effectively resetting it.