Sha256: 10700032bbc2288154c18242edb2041228aa3558f4688891b46d9f3056abcb99

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

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

describe LogStash::Api::Modules::Plugins do

  include Rack::Test::Methods

  def app()
    described_class
  end

  before(:all) 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(plugin).to be_available?
      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

4 entries across 4 versions & 1 rubygems

Version Path
logstash-core-5.0.0.alpha4.snapshot1-java spec/api/lib/api/plugins_spec.rb
logstash-core-5.0.0.alpha3-java spec/api/lib/api/plugins_spec.rb
logstash-core-5.0.0.alpha3.snapshot8-java spec/api/lib/api/plugins_spec.rb
logstash-core-5.0.0.alpha3.snapshot7-java spec/api/lib/api/plugins_spec.rb