|
NAMESearch::Elasticsearch::TestServer - A helper class to launch Elasticsearch nodes VERSIONversion 8.12 SYNOPSIS use Search::Elasticsearch;
use Search::Elasticsearch::TestServer;
my $server = Search::Elasticsearch::TestServer->new(
es_home => '/path/to/elasticsearch', # defaults to $ENV{ES_HOME}
es_version => '6_0' # defaults to $ENV{ES_VERSION}
);
my $nodes = $server->start;
my $es = Search::Elasticsearch->new( nodes => $nodes );
# run tests
$server->shutdown;
DESCRIPTIONThe Search::Elasticsearch::TestServer class can be used to launch one or more instances of Elasticsearch for testing purposes. The nodes will be shutdown automatically. METHODSnew() my $server = Search::Elasticsearch::TestServer->new(
es_home => '/path/to/elasticsearch',
es_version => '6_0',
instances => 1,
http_port => 9600,
es_port => 9700,
conf => ['attr.foo=bar'],
);
Params:
start()$nodes = $server->start; Starts the required instances and returns an array ref containing the IP and port of each node, suitable for passing to "new()" in Search::Elasticsearch: $es = Search::Elasticsearch->new( nodes => $nodes ); shutdown()$server->shutdown; Kills the running instances. This will be called automatically when $server goes out of scope or if the program receives a "SIGINT". AUTHOREnrico Zimuel <enrico.zimuel@elastic.co> COPYRIGHT AND LICENSEThis software is Copyright (c) 2024 by Elasticsearch BV. This is free software, licensed under: The Apache License, Version 2.0, January 2004
|