Skip to content

Commit

Permalink
skipping UDS tests in jruby
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <[email protected]>
  • Loading branch information
pedro-stanaka committed Dec 19, 2024
1 parent 5ed58a3 commit 6c42666
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions test/environment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_client_from_env_uses_regular_udp_sink_when_buffer_capacity_is_0
end

def test_client_from_env_uses_uds_sink_with_correct_packet_size_in_production
skip_on_jruby("JRuby does not support UNIX domain sockets")
socket_path = "/tmp/statsd-test-#{Process.pid}.sock"

# Create a UDS server socket
Expand Down Expand Up @@ -105,6 +106,7 @@ def test_client_from_env_uses_uds_sink_with_correct_packet_size_in_production
end

def test_client_from_env_uses_default_packet_size_for_uds_when_not_specified
skip_on_jruby("JRuby does not support UNIX domain sockets")
socket_path = "/tmp/statsd-test-#{Process.pid}-default.sock"

# Create a UDS server socket
Expand Down Expand Up @@ -134,6 +136,7 @@ def test_client_from_env_uses_default_packet_size_for_uds_when_not_specified
end

def test_client_from_env_uses_batched_uds_sink_with_correct_packet_size
skip_on_jruby("JRuby does not support UNIX domain sockets")
socket_path = "/tmp/statsd-test-#{Process.pid}-batched.sock"

# Create a UDS server socket
Expand Down
9 changes: 9 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ def strict_mode_enabled?
end
end

# Add helper methods available to all tests
module Minitest
class Test
def skip_on_jruby(message = "Test skipped on JRuby")
skip(message) if RUBY_ENGINE == "jruby"
end
end
end

StatsD.logger = Logger.new(File::NULL)

Thread.abort_on_exception = true
Expand Down
4 changes: 0 additions & 4 deletions test/uds_sink_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def sink
@sink ||= build_sink(@socket_path)
end

def skip_on_jruby(message = "JRuby does not support UNIX domain sockets")
skip(message) if RUBY_PLATFORM == "java"
end

def read_datagrams(count, timeout: ENV["CI"] ? 5 : 1)
datagrams = []
count.times do
Expand Down

0 comments on commit 6c42666

Please sign in to comment.