Sha256: 9238e7192e3a328afcb774b7fe937b6bd587cafd73a4ae25923c1344981cbc65

Contents?: true

Size: 1.86 KB

Versions: 151

Compression:

Stored size: 1.86 KB

Contents

require_relative 'helper'
require 'fluent/tls'

class UniqueIdTest < Test::Unit::TestCase
  TEST_TLS1_1_CASES = {
    'New TLS v1.1' => :'TLS1_1',
    'Old TLS v1.1' => :'TLSv1_1',
  }
  TEST_TLS1_2_CASES = {
    'New TLS v1.2' => :'TLS1_2',
    'Old TLS v1.2' => :'TLSv1_2'
  } 
  TEST_TLS_CASES = TEST_TLS1_1_CASES.merge(TEST_TLS1_2_CASES)

  sub_test_case 'constants' do
    test 'default version' do
      assert_equal :'TLSv1_2', Fluent::TLS::DEFAULT_VERSION
    end

    data(TEST_TLS_CASES)
    test 'supported versions' do |ver|
      assert_include Fluent::TLS::SUPPORTED_VERSIONS, ver
    end

    test 'default ciphers' do
      assert_equal "ALL:!aNULL:!eNULL:!SSLv2", Fluent::TLS::CIPHERS_DEFAULT
    end
  end

  sub_test_case 'set_version_to_context' do
    setup do
      @ctx = OpenSSL::SSL::SSLContext.new
    end

    # TODO: After openssl module supports min_version/max_version accessor, add assert for it.

    data(TEST_TLS_CASES)
    test 'with version' do |ver|
      assert_nothing_raised {
        Fluent::TLS.set_version_to_context(@ctx, ver, nil, nil)
      }
    end

    data(TEST_TLS_CASES)
    test 'can specify old/new syntax to min_version/max_version' do |ver|
      omit "min_version=/max_version= is not supported" unless Fluent::TLS::MIN_MAX_AVAILABLE

      assert_nothing_raised {
        Fluent::TLS.set_version_to_context(@ctx, Fluent::TLS::DEFAULT_VERSION, ver, ver)
      }
    end

    test 'raise ConfigError when either one of min_version/max_version is not specified' do
      omit "min_version=/max_version= is not supported" unless Fluent::TLS::MIN_MAX_AVAILABLE

      ver = Fluent::TLS::DEFAULT_VERSION
      assert_raise(Fluent::ConfigError) {
        Fluent::TLS.set_version_to_context(@ctx, ver, ver, nil)
      }
      assert_raise(Fluent::ConfigError) {
        Fluent::TLS.set_version_to_context(@ctx, ver, nil, ver)
      }
    end
  end
end

Version data entries

151 entries across 151 versions & 7 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/test_tls.rb
fluentd-1.16.6-x86-mingw32 test/test_tls.rb
fluentd-1.16.6-x64-mingw32 test/test_tls.rb
fluentd-1.16.6-x64-mingw-ucrt test/test_tls.rb
fluentd-1.16.6 test/test_tls.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/test_tls.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/test_tls.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/test/test_tls.rb
fluentd-1.17.0-x86-mingw32 test/test_tls.rb
fluentd-1.17.0-x64-mingw-ucrt test/test_tls.rb
fluentd-1.17.0-x64-mingw32 test/test_tls.rb
fluentd-1.17.0 test/test_tls.rb
fluentd-1.16.5-x64-mingw-ucrt test/test_tls.rb
fluentd-1.16.5-x86-mingw32 test/test_tls.rb
fluentd-1.16.5-x64-mingw32 test/test_tls.rb
fluentd-1.16.5 test/test_tls.rb
fluentd-1.16.4-x64-mingw-ucrt test/test_tls.rb
fluentd-1.16.4-x86-mingw32 test/test_tls.rb
fluentd-1.16.4-x64-mingw32 test/test_tls.rb
fluentd-1.16.4 test/test_tls.rb