Sha256: 68e5f4762c84e10d0b5c202464a9b1283184b6bc7f15f6851c13d5917fdff360

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require "spec_helper"
require_relative "../../support/helpers"
require "logstash/pipeline_action/stop"
require "logstash/pipeline"

describe LogStash::PipelineAction::Stop do
  let(:pipeline_config) { "input { generator {} } output { null {} }" }
  let(:pipeline_id) { :main }
  let(:pipeline) { mock_pipeline_from_string(pipeline_config) }
  let(:pipelines) { chm = java.util.concurrent.ConcurrentHashMap.new; chm[:main] = pipeline; chm }
  let(:agent) { double("agent") }

  subject { described_class.new(pipeline_id) }

  before do
    clear_data_dir
    pipeline.start
  end

  after do
    pipeline.shutdown
  end

  it "returns the pipeline_id" do
    expect(subject.pipeline_id).to eq(:main)
  end

  it "shutdown the running pipeline" do
    expect { subject.execute(agent, pipelines) }.to change(pipeline, :running?).from(true).to(false)
  end

  it "removes the pipeline from the running pipelines" do
    expect { subject.execute(agent, pipelines) }.to change { pipelines.include?(pipeline_id) }.from(true).to(false)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
logstash-core-6.6.0-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-7.0.0.alpha2-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.5.4-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.5.3-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.5.2-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.5.1-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-7.0.0.alpha1-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.5.0-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.4.3-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.4.2-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.4.1-java spec/logstash/pipeline_action/stop_spec.rb
logstash-core-6.4.0-java spec/logstash/pipeline_action/stop_spec.rb