Sha256: 7cd922681544c0cf78257ab4b77a659d23f4dcbd51e64c03aeafa9a088281533

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

require "test-unit"
require "fluent/test"
require "fluent/test/driver/input"
require "fluent/test/helpers"
require "./lib/fluent/plugin/in_sqs.rb"

class InSqsTest < Test::Unit::TestCase
  include Fluent::Test::Helpers

  # default configuration for tests
  DEFAULT_VALID_CONFIG = %[
    tag test_tag
    sqs_url http://sqs-url.com
  ]

  setup do
    Fluent::Test.setup # this is required to setup router and others
  end

  def create_driver(conf = DEFAULT_VALID_CONFIG)
    Fluent::Test::Driver::Input.new(Fluent::Plugin::SQSInput).configure(conf)
  end
  
  sub_test_case 'configured with invalid configurations' do
    test 'should reject because tag is missing' do
      assert_raise Fluent::ConfigError do
        create_driver(%[
          sqs_url http://sqs-url.com
        ])
      end
    end

    test 'should reject because sqs_url is missing' do
      assert_raise Fluent::ConfigError do
        create_driver(%[
          tag test_tag
        ])
      end
    end

    test 'params are set correctly' do
      d = create_driver
      assert_equal "test_tag", d.instance.tag
      assert_equal "eu-central-1", d.instance.region
      assert_equal "http://sqs-url.com", d.instance.sqs_url
      assert_equal 0.1, d.instance.receive_interval
      assert_equal 10, d.instance.max_number_of_messages
      assert_equal 10, d.instance.wait_time_seconds
    end
  end # end of configured with invalid configurations sub_test_case

end  

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
fluent-plugin-aws-sqs-1.0.25 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.24 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.23 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.22 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.21 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.20 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.19 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.18 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.17 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.16 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.15 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.14 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.13 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.12 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.11 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.10 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.9 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.8 tests/test_in_sqs.rb
fluent-plugin-aws-sqs-1.0.7 tests/test_in_sqs.rb