Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
5 changes: 2 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
5 changes: 2 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
37 changes: 16 additions & 21 deletions test/plugin/test_out_irc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down