Sha256: 5cfe66289dd0c3968c63c5e15f93d48972177920c5bb3f43f964b244eb3b2dcd

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require_relative "../test_helper"

class GcloudPubSubInputTest < Test::Unit::TestCase
  CONFIG = %[
      tag test
      project project-test
      subscription subscription-test
      key key-test
      format json
  ]

  def create_driver(conf=CONFIG)
    Fluent::Test::InputTestDriver.new(Fluent::GcloudPubSubInput).configure(conf)
  end

  setup do
    Fluent::Test.setup
  end

  sub_test_case 'configure' do
    test 'all params are configured' do
      d = create_driver(%[
        tag test
        project project-test
        topic topic-test
        subscription subscription-test
        key key-test
        max_messages 1000
        return_immediately true
        pull_interval 2
        format ltsv
      ])

      assert_equal('test', d.instance.tag)
      assert_equal('project-test', d.instance.project)
      assert_equal('topic-test', d.instance.topic)
      assert_equal('subscription-test', d.instance.subscription)
      assert_equal('key-test', d.instance.key)
      assert_equal(2, d.instance.pull_interval)
      assert_equal(1000, d.instance.max_messages)
      assert_equal(true, d.instance.return_immediately)
      assert_equal('ltsv', d.instance.format)
    end

    test 'default values are configured' do
      d = create_driver
      assert_equal(nil, d.instance.topic)
      assert_equal(5, d.instance.pull_interval)
      assert_equal(100, d.instance.max_messages)
      assert_equal(true, d.instance.return_immediately)
      assert_equal('json', d.instance.format)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-plugin-gcloud-pubsub-custom-0.1.2 test/plugin/test_in_gcloud_pubsub.rb
fluent-plugin-gcloud-pubsub-custom-0.1.1 test/plugin/test_in_gcloud_pubsub.rb
fluent-plugin-gcloud-pubsub-custom-0.1.0 test/plugin/test_in_gcloud_pubsub.rb