Sha256: ac63827f8d43a428ca4f2235c0fd8aba43dacd0ffc190b0868e4b99839b8b23e

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

# SPDX-License-Identifier: Apache-2.0
#
#  The OpenSearch Contributors require contributions made to
#  this file be licensed under the Apache-2.0 license or a
#  compatible open source license.
#
#  Modifications Copyright OpenSearch Contributors. See
#  GitHub history for details.

require "logstash/devutils/rspec/spec_helper"
require "logstash/outputs/opensearch/template_manager"

describe LogStash::Outputs::OpenSearch::TemplateManager do

  describe ".default_template_path" do
    context 'when ECS v1 is requested' do
      it 'resolves' do
        expect(described_class.default_template_path(7, :v1)).to end_with("/templates/ecs-v1/7x.json")
      end
    end
  end

  describe "index template settings" do
    let(:plugin_settings) { {"manage_template" => true, "template_overwrite" => true} }
    let(:plugin) { LogStash::Outputs::OpenSearch.new(plugin_settings) }

    describe "use template api" do
      let(:file_path) { described_class.default_template_path(7) }
      let(:template) { described_class.read_template_file(file_path)}

      it "should update settings" do
        expect(template.include?('template')).to be_falsey
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-output-opensearch-1.2.0-java spec/unit/outputs/opensearch/template_manager_spec.rb
logstash-output-opensearch-1.1.0-java spec/unit/outputs/opensearch/template_manager_spec.rb
logstash-output-opensearch-1.0.0-java spec/unit/outputs/opensearch/template_manager_spec.rb