Sha256: d1a4830551601780f68a8d225bd4f3dc440c77592882e07c71c09d2ca43a4290

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require_relative '../helper'
require 'fluent/test/driver/input'
require 'fluent/plugin/in_mqtt'

class MqttInputTest < Test::Unit::TestCase
  def setup
    Fluent::Test.setup
  end


  CONFIG = %[
  ]

  def create_driver(conf = CONFIG, opts = {})
    Fluent::Test::Driver::Input.new(Fluent::Plugin::MqttInput, opts: opts).configure(conf)
  end

  sub_test_case "configure" do
    test "host and port" do
      d = create_driver %[
          host 127.0.0.1
          port 1300
          client_id aa-bb-cc-dd
          <parse>
            @type json
            time_format %FT%T%:z
          </parse>
          <security>
            use_tls true
            <tls>
              ca_file /cert/cacert.pem
              key_file /cert/private.key
              cert_file /cert/cert.pem
            </tls>
          </security>

      ]
      assert_equal '127.0.0.1', d.instance.host
      assert_equal 1300, d.instance.port
      assert_equal 'aa-bb-cc-dd', d.instance.client_id

      assert_equal true, d.instance.security.use_tls
      assert_equal '/cert/cacert.pem', d.instance.security.tls.ca_file
      assert_equal '/cert/private.key', d.instance.security.tls.key_file
      assert_equal '/cert/cert.pem', d.instance.security.tls.cert_file

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-plugin-mqtt-io-0.3.10 test/plugin/test_in_mqtt.rb
fluent-plugin-mqtt-io-0.4.0 test/plugin/test_in_mqtt.rb
fluent-plugin-mqtt-io-0.3.9 test/plugin/test_in_mqtt.rb