.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Search::Elasticsearch::TestServer 3pm" .TH Search::Elasticsearch::TestServer 3pm 2024-02-04 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Search::Elasticsearch::TestServer \- A helper class to launch Elasticsearch nodes .SH VERSION .IX Header "VERSION" version 8.12 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Search::Elasticsearch; \& use Search::Elasticsearch::TestServer; \& \& my $server = Search::Elasticsearch::TestServer\->new( \& es_home => \*(Aq/path/to/elasticsearch\*(Aq, # defaults to $ENV{ES_HOME} \& es_version => \*(Aq6_0\*(Aq # defaults to $ENV{ES_VERSION} \& ); \& \& my $nodes = $server\->start; \& my $es = Search::Elasticsearch\->new( nodes => $nodes ); \& # run tests \& $server\->shutdown; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The Search::Elasticsearch::TestServer class can be used to launch one or more instances of Elasticsearch for testing purposes. The nodes will be shutdown automatically. .SH METHODS .IX Header "METHODS" .ie n .SS new() .el .SS \f(CWnew()\fP .IX Subsection "new()" .Vb 8 \& my $server = Search::Elasticsearch::TestServer\->new( \& es_home => \*(Aq/path/to/elasticsearch\*(Aq, \& es_version => \*(Aq6_0\*(Aq, \& instances => 1, \& http_port => 9600, \& es_port => 9700, \& conf => [\*(Aqattr.foo=bar\*(Aq], \& ); .Ve .PP Params: .IP \(bu 4 \&\f(CW\*(C`es_home\*(C'\fR .Sp Required. Must point to the Elasticsearch home directory, which contains \&\f(CW\*(C`./bin/elasticsearch\*(C'\fR. Defaults to \f(CW$ENV{ES_HOME}\fR .IP \(bu 4 \&\f(CW\*(C`es_version\*(C'\fR .Sp Required. Accepts a version of the client, eg `6_0`, `5_0`, `2_0`, `1_0`, `0_90`. Defaults to \f(CW$ENV{ES_VERSION}\fR. .IP \(bu 4 \&\f(CW\*(C`instances\*(C'\fR .Sp The number of nodes to start. Defaults to 1 .IP \(bu 4 \&\f(CW\*(C`http_port\*(C'\fR .Sp The port to use for HTTP. If multiple instances are started, the \f(CW\*(C`http_port\*(C'\fR will be incremented for each subsequent instance. Defaults to 9600. .IP \(bu 4 \&\f(CW\*(C`es_port\*(C'\fR .Sp The port to use for Elasticsearch's internal transport. If multiple instances are started, the \f(CW\*(C`es_port\*(C'\fR will be incremented for each subsequent instance. Defaults to 9700 .IP \(bu 4 \&\f(CW\*(C`conf\*(C'\fR .Sp An array containing any extra startup options that should be passed to Elasticsearch. .ie n .SH start() .el .SH \f(CWstart()\fP .IX Header "start()" .Vb 1 \& $nodes = $server\->start; .Ve .PP Starts the required instances and returns an array ref containing the IP and port of each node, suitable for passing to "\fBnew()\fR" in Search::Elasticsearch: .PP .Vb 1 \& $es = Search::Elasticsearch\->new( nodes => $nodes ); .Ve .ie n .SH shutdown() .el .SH \f(CWshutdown()\fP .IX Header "shutdown()" .Vb 1 \& $server\->shutdown; .Ve .PP Kills the running instances. This will be called automatically when \&\f(CW$server\fR goes out of scope or if the program receives a \f(CW\*(C`SIGINT\*(C'\fR. .SH AUTHOR .IX Header "AUTHOR" Enrico Zimuel .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2024 by Elasticsearch BV. .PP This is free software, licensed under: .PP .Vb 1 \& The Apache License, Version 2.0, January 2004 .Ve