Sha256: 644d752e5f1b8f27e4af62366da1ca03810cf5ab9d43160d00f0eeae3952b690

Contents?: true

Size: 1.33 KB

Versions: 58

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8
require "spec_helper"
require "sinatra"
require "logstash/api/modules/plugins"
require "logstash/json"

describe LogStash::Api::Modules::Plugins do
  include_context "api setup"
  include_examples "not found"

  before(:each) do
    get "/"
  end

  let(:payload) { LogStash::Json.load(last_response.body) }

  it "respond to plugins resource" do
    expect(last_response).to be_ok
  end

  it "return valid json content type" do
    expect(last_response.content_type).to eq("application/json"), "Did not get json, got #{last_response.content_type} / #{last_response.body}"
  end

  context "#schema" do
    it "return the expected schema" do
      expect(payload.keys).to include("plugins", "total")
      payload["plugins"].each do |plugin|
        expect(plugin.keys).to include("name", "version")
      end
    end
  end

  context "#values" do

    it "return totals of plugins" do
      expect(payload["total"]).to eq(payload["plugins"].count)
    end

    it "return a list of available plugins" do
      payload["plugins"].each do |plugin|
        expect do 
          Gem::Specification.find_by_name(plugin["name"])
        end.not_to raise_error
      end
    end

    it "return non empty version values" do
      payload["plugins"].each do |plugin|
        expect(plugin["version"]).not_to be_empty
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 6 rubygems

Version Path
logstash-core-5.6.8-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.7-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.6-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.5-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.4-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.3-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.2-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.1-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.5.3-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.6.0-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.5.2-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.5.1-java spec/logstash/api/modules/plugins_spec.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/logstash-core-5.5.1.snapshot1-java/spec/logstash/api/modules/plugins_spec.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.5.1.snapshot1-java/spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.5.1.snapshot1-java spec/logstash/api/modules/plugins_spec.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.5.0-java/spec/logstash/api/modules/plugins_spec.rb
logstash-core-5.5.0-java spec/logstash/api/modules/plugins_spec.rb
logstash-core-6.0.0.alpha2-java spec/logstash/api/modules/plugins_spec.rb