Sha256: f89544a16781392cdcb12c1ffe08b9a75d8628a317f33e8fa7915401f95e0a14

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

require 'helper'

require 'fluent/plugin/input_session'

require 'ipaddr'

class InputSessionTest < Test::Unit::TestCase

  def test_check_node
    # def check_node(hostname, ipaddress, port, proto)
    nodes = [
      { address: IPAddr.new('127.0.0.1'), shared_key: 'shared_key', users: ['tagomoris', 'repeatedly'] },
      { address: IPAddr.new('2001:DB8::9'), shared_key: 'shared_key2', users: nil },
      { address: IPAddr.new('127.0.0.0/24'), shared_key: 'shared_key3', users: ['tagomoris', 'repeatedly'] },
    ]
    p1 = DummyInputPlugin.new(nodes: nodes)
    s1 = Fluent::SecureForwardInput::Session.new(p1, DummySocket.new)

    assert s1.check_node('127.0.0.1')
    assert_equal 'shared_key', s1.check_node('127.0.0.1')[:shared_key]

    assert s1.check_node('127.0.0.127')
    assert_equal 'shared_key3', s1.check_node('127.0.0.127')[:shared_key]

    assert_nil s1.check_node('192.0.2.8')
    assert_nil s1.check_node('2001:DB8::8')

    assert s1.check_node('2001:DB8::9')
    assert_equal 'shared_key2', s1.check_node('2001:DB8::9')[:shared_key]
  end

  def test_generate_helo
  end

  def test_check_ping
  end

  def test_generate_pong
  end

  def test_on_read
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fluent-plugin-secure-forward-0.2.0 test/plugin/test_input_session.rb
fluent-plugin-secure-forward-0.1.9.pre.rc1 test/plugin/test_input_session.rb