Skip to content

Commit

Permalink
Updated endpoints to 8.12 + fixed platinum test
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jan 24, 2024
1 parent f879100 commit 8f6294c
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 22 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ steps:
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.12-SNAPSHOT
CLIENT_VER: "8_0"
PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT: 1
matrix:
setup:
suite:
Expand Down
2 changes: 2 additions & 0 deletions lib/Search/Elasticsearch/Client/8_0/Direct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ has 'cat' => ( is => 'lazy', init_arg => undef );
has 'ccr' => ( is => 'lazy', init_arg => undef );
has 'cluster' => ( is => 'lazy', init_arg => undef );
has 'connector' => ( is => 'lazy', init_arg => undef );
has 'connector_sync_job' => ( is => 'lazy', init_arg => undef );
has 'dangling_indices' => ( is => 'lazy', init_arg => undef );
has 'enrich' => ( is => 'lazy', init_arg => undef );
has 'eql' => ( is => 'lazy', init_arg => undef );
Expand Down Expand Up @@ -100,6 +101,7 @@ sub _build_cat { shift->_build_namespace('Cat') }
sub _build_ccr { shift->_build_namespace('CCR') }
sub _build_cluster { shift->_build_namespace('Cluster') }
sub _build_connector { shift->_build_namespace('Connector') }
sub _build_connector_sync_job { shift->_build_namespace('ConnectorSyncJob') }
sub _build_dangling_indices { shift->_build_namespace('DanglingIndices') }
sub _build_enrich { shift->_build_namespace('Enrich') }
sub _build_eql { shift->_build_namespace('Eql') }
Expand Down
56 changes: 56 additions & 0 deletions lib/Search/Elasticsearch/Client/8_0/Direct/ConnectorSyncJob.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

package Search::Elasticsearch::Client::8_0::Direct::ConnectorSyncJob;

use Moo;
with 'Search::Elasticsearch::Client::8_0::Role::API';
with 'Search::Elasticsearch::Role::Client::Direct';
__PACKAGE__->_install_api('connector_sync_job');

1;

__END__
# ABSTRACT: A client for create and manage Elastic sync jobs
=head1 DESCRIPTION
The sync jobs API provides a convenient way to create
and manage Elastic sync jobs in an internal index.
This API provides an alternative to relying solely on Kibana UI
for sync job management.
The full documentation for Sync job feature is available here:
L<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/connector-apis.html#sync-job-apis>
It does L<Search::Elasticsearch::Role::Client::Direct>.
=head1 METHODS
=head2 C<put()>
$response = $e->connector_sync_job->post(
body => {
id => "connector-id",
job_type => "full",
trigger_method => 'on_demand'
}
);
The C<post()> method create a connector sync job.
6 changes: 5 additions & 1 deletion t/lib/es_async.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
use strict;
use warnings;

$ENV{ES} = $ENV{ELASTICSEARCH_URL} || 'https://elastic:changeme@localhost:9200';

my $trace
= !$ENV{TRACE} ? undef
: $ENV{TRACE} eq '1' ? 'Stderr'
Expand Down Expand Up @@ -67,11 +69,13 @@
}
}

$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = 1;

my $es;
if ( $ENV{ES} ) {
eval {
$es = Search::Elasticsearch::Async->new(
nodes => $ENV{ES},
nodes => [ $ENV{ES} ],
trace_to => $trace,
cxn => $cxn,
cxn_pool => $cxn_pool,
Expand Down
43 changes: 23 additions & 20 deletions t/lib/es_sync.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,29 @@
our %Auth;

my $es;
if ( $ENV{ES} ) {
eval {
$es = Search::Elasticsearch->new(
nodes => $ENV{ES},
trace_to => $trace,
cxn => $cxn,
cxn_pool => $cxn_pool,
client => $api,
send_get_body_as => $body,
request_timeout => $timeout,
plugins => \@plugins,
%Auth
);
$es->ping unless $ENV{ES_SKIP_PING};
1;
} || do {
diag $@;
undef $es;
};
}

$ENV{ES} = $ENV{ELASTICSEARCH_URL} || 'https://elastic:changeme@localhost:9200';
$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} = 1;

eval {
$es = Search::Elasticsearch->new(
nodes => [ $ENV{ES} ],
trace_to => $trace,
cxn => $cxn,
cxn_pool => $cxn_pool,
client => $api,
send_get_body_as => $body,
request_timeout => $timeout,
plugins => \@plugins,
%Auth
);
$es->ping unless $ENV{ES_SKIP_PING};
1;
} || do {
diag $@;
undef $es;
};


unless ( $ENV{ES_SKIP_PING} ) {
my $version = $es->info->{version}{number};
Expand Down
23 changes: 23 additions & 0 deletions test/skip_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,33 @@
- aggregations/min_bucket.yml
- aggregations/percentiles_bucket.yml
- aggregations/sum_bucket.yml
- analytics/top_metrics.yml
- analytics/cumulative_cardinality.yml
- cat.segments/10_basic.yml
- eql/10_basic.yml
- field_caps/40_time_series.yml
- ml/calendar_crud.yml
- ml/data_frame_analytics_crud.yml
- ml/evaluate_data_frame.yml
- ml/explain_data_frame_analytics.yml
- ml/forecast.yml
- ml/jobs_crud.yml
- ml/preview_datafeed.yml
- ml/start_data_frame_analytics.yml
- ml/stop_data_frame_analytics.yml
- rules/10_pinned_query.yml
- search/150_rewrite_on_coordinator.yml
- search/220_total_hits_object.yml
- search.highlight/10_unified.yml
- search.vectors/90_sparse_vector.yml
- spatial/100_geo_grid_ingest.yml
- spatial/130_geo_shape_runtime.yml
- sql/sql.yml
- ssl/10_basic.yml
- transform/transforms_crud.yml
- transform/transforms_start_stop.yml
- transform/transforms_stats.yml
- transform/transforms_stats_continuous.yml
- transform/transforms_update.yml
- transform/transforms_upgrade.yml
- tsdb/*
2 changes: 1 addition & 1 deletion util/get_elasticsearch_info.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sub get_elasticsearch_info {
#===================================
$ENV{ES} = $ENV{ELASTICSEARCH_URL} || 'https://elastic:changeme@localhost:9200';

my $response = HTTP::Tiny->new->get($ENV{ES}) or die "The server $ENV{ES} is not running!";
my $response = HTTP::Tiny->new(verify_SSL => 0)->get($ENV{ES}) or die "The server $ENV{ES} is not running!";
unless ($response->{success}) {
die "ERROR: The server $ENV{ES} is not running!\n";
}
Expand Down

0 comments on commit 8f6294c

Please sign in to comment.