Skip to content

Commit

Permalink
test macos
Browse files Browse the repository at this point in the history
  • Loading branch information
daipom committed Nov 25, 2024
1 parent feda2ea commit 3215d27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Test

on:
push:
branches: [master]
paths-ignore:
- '*.md'
- 'lib/fluent/version.rb'
Expand All @@ -25,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
os: ['macos-latest']
ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7']

name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
Expand All @@ -42,4 +41,4 @@ jobs:
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rake test TESTOPTS="-v --no-show-detail-immediately"
run: bundle exec rake test TESTOPTS="-v --no-show-detail-immediately -t'TestFluentdCommand::zero_downtime_restart'"
23 changes: 16 additions & 7 deletions test/command/test_fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ def conf(udp_port, tcp_port, syslog_port)
def run_fluentd(config)
conf_path = create_conf_file("test.conf", config)
assert File.exist?(conf_path)
cmdline = create_cmdline(conf_path)
cmdline = create_cmdline(conf_path, "-vv")

stdio_buf = ""
execute_command(cmdline) do |pid, stdout|
Expand Down Expand Up @@ -1464,7 +1464,7 @@ def send_end(port)
end

test "should restart with zero downtime (no data loss)" do
print_logs = false # set true if you need to print logs for debug
print_logs = true # set true if you need to print logs for debug

udp_port, syslog_port = unused_port(2, protocol: :udp)
tcp_port = unused_port(protocol: :tcp)
Expand Down Expand Up @@ -1513,20 +1513,29 @@ def send_end(port)
elsif phase == "flush"
phase = "done"
threads << Thread.new do
sleep 5
sleep 10
send_end(tcp_port)
end
end
end

assert_equal(

Check failure on line 1522 in test/command/test_fluentd.rb

View workflow job for this annotation

GitHub Actions / Ruby 3.2 on macos-latest

Failure

<[500, 500, 500]> expected but was <[435, 430, 443]>.

Check failure on line 1522 in test/command/test_fluentd.rb

View workflow job for this annotation

GitHub Actions / Ruby 2.7 on macos-latest

Failure

<[500, 500, 500]> expected but was <[500, 472, 500]>. diff: - [500, 500, 500] ? ^^^ + [500, 472, 500] ? ^^^
[(0..499).to_a, (0..499).to_a, (0..499).to_a],
[500, 500, 500],
[
records_by_type["udp"].sort,
records_by_type["tcp"].sort,
records_by_type["syslog"].sort,
records_by_type["udp"].size,
records_by_type["tcp"].size,
records_by_type["syslog"].size,
]
)

# assert_equal(
# [(0..499).to_a, (0..499).to_a, (0..499).to_a],
# [
# records_by_type["udp"].sort,
# records_by_type["tcp"].sort,
# records_by_type["syslog"].sort,
# ]
# )
ensure
threads.each(&:kill)
end
Expand Down

0 comments on commit 3215d27

Please sign in to comment.