diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index be5dfa4..1abea83 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [ '2.5', '2.6', '2.7' ] + ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ] os: - ubuntu-latest name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }} @@ -17,10 +17,9 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + bundler-cache: true - name: unit testing env: CI: true run: | - gem install bundler rake - bundle install --jobs 4 --retry 3 bundle exec rake test diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4a50081..c3c7afd 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [ '2.5', '2.6', '2.7' ] + ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ] os: - macOS-latest name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }} @@ -17,10 +17,9 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + bundler-cache: true - name: unit testing env: CI: true run: | - gem install bundler rake - bundle install --jobs 4 --retry 3 bundle exec rake test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 41c5582..b3da332 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [ '2.5', '2.6', '2.7' ] + ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3', '3.4' ] os: - windows-latest name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }} @@ -17,10 +17,9 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + bundler-cache: true - name: unit testing env: CI: true run: | - gem install bundler rake - bundle install --jobs 4 --retry 3 bundle exec rake test diff --git a/test/plugin/test_out_irc.rb b/test/plugin/test_out_irc.rb index fa7b854..16fd4c7 100644 --- a/test/plugin/test_out_irc.rb +++ b/test/plugin/test_out_irc.rb @@ -19,23 +19,17 @@ def setup Fluent::Engine.now = Time.now end - def config( - port: PORT, - channel: CHANNEL, - channel_keys: "", - command: COMMAND.to_s, - command_keys: nil - ) - config = %[ + def config(options = {}) + data = %[ type irc host localhost - port #{port} - channel #{channel} - channel_keys #{channel_keys} + port #{options.fetch(:port, PORT)} + channel #{options.fetch(:channel, CHANNEL)} + channel_keys #{options.fetch(:channel_keys, "")} nick #{NICK} user #{USER} real #{REAL} - command #{command} + command #{options.fetch(:command, COMMAND.to_s)} message #{MESSAGE} out_keys tag,time,msg time_key time @@ -44,8 +38,9 @@ def config( send_queue_limit 10 send_interval 0.5 ] - config += %[command_keys #{command_keys}] if command_keys - config + command_keys = options.fetch(:command_keys, nil) + data += %[command_keys #{command_keys}] if command_keys + data end @@ -73,25 +68,25 @@ def test_configure end def test_configure_channel_keys - d = create_driver(config(channel:"%s", channel_keys:"channel")) + d = create_driver(config({channel:"%s", channel_keys:"channel"})) assert_equal "#%s", d.instance.channel assert_equal ["channel"], d.instance.channel_keys end def test_configure_command_keys - d = create_driver(config(command:"%s", command_keys:"command")) + d = create_driver(config({command:"%s", command_keys:"command"})) assert_equal "%s", d.instance.command assert_equal ["command"], d.instance.command_keys end def test_configure_command assert_raise Fluent::ConfigError do - create_driver(config(command: 'foo')) + create_driver(config({command: 'foo'})) end - assert_nothing_raised { create_driver(config(command: 'priv_msg')) } - assert_nothing_raised { create_driver(config(command: 'privmsg')) } - assert_nothing_raised { create_driver(config(command: 'notice')) } + assert_nothing_raised { create_driver(config({command: 'priv_msg'})) } + assert_nothing_raised { create_driver(config({command: 'privmsg'})) } + assert_nothing_raised { create_driver(config({command: 'notice'})) } end def test_emit @@ -111,7 +106,7 @@ def test_emit s = IRCParser.parse(socket.gets) m[s.class.to_sym] = s - s = IRCParser.parse(socket.gets) + s = IRCParser.parse(socket.gets&.force_encoding("utf-8")) m[s.class.to_sym] = s assert_equal ["##{CHANNEL}"], m[:join].channels