Skip to content
Browse files

use pending to abort tests that don't apply here

  • Loading branch information...
1 parent ba693d3 commit 728928cb9aa9094e5b82a6015a2110bffb606057 Blaine Cook committed Aug 26, 2008
Showing with 29 additions and 32 deletions.
  1. +29 −32 test/test_starling_server.rb
View
61 test/test_starling_server.rb
@@ -146,45 +146,42 @@ def safely_fork(&block)
# handle more than 1024 connections.
unless IO::popen("uname").read.chomp == "Linux"
- raise "(Skipping epoll test: not on Linux)"
- skip = true
+ pending "skipping epoll test: not on Linux"
end
+
fd_limit = IO::popen("bash -c 'ulimit -n'").read.chomp.to_i
unless fd_limit > 1024
- raise "(Skipping epoll test: 'ulimit -n' = #{fd_limit}, need > 1024)"
- skip = true
+ pending "skipping epoll test: 'ulimit -n' = #{fd_limit}, need > 1024"
end
- unless skip
- v = rand(2**32 - 1)
- @client.set('test_epoll', v)
-
- # we can't open 1024 connections to memcache from within this process,
- # because we will hit ruby's 1024 fd limit ourselves!
- pid1 = safely_fork do
- unused_sockets = []
- 600.times do
- unused_sockets << TCPSocket.new("127.0.0.1", 22133)
- end
- Process.kill("USR1", Process.ppid)
- sleep 90
+ v = rand(2**32 - 1)
+ @client.set('test_epoll', v)
+
+ # we can't open 1024 connections to memcache from within this process,
+ # because we will hit ruby's 1024 fd limit ourselves!
+ pid1 = safely_fork do
+ unused_sockets = []
+ 600.times do
+ unused_sockets << TCPSocket.new("127.0.0.1", 22133)
end
- pid2 = safely_fork do
- unused_sockets = []
- 600.times do
- unused_sockets << TCPSocket.new("127.0.0.1", 22133)
- end
- Process.kill("USR1", Process.ppid)
- sleep 90
+ Process.kill("USR1", Process.ppid)
+ sleep 90
+ end
+ pid2 = safely_fork do
+ unused_sockets = []
+ 600.times do
+ unused_sockets << TCPSocket.new("127.0.0.1", 22133)
end
+ Process.kill("USR1", Process.ppid)
+ sleep 90
+ end
- begin
- client = MemCache.new('127.0.0.1:22133')
- client.get('test_epoll').should eql(v)
- ensure
- Process.kill("TERM", pid1)
- Process.kill("TERM", pid2)
- end
+ begin
+ client = MemCache.new('127.0.0.1:22133')
+ client.get('test_epoll').should eql(v)
+ ensure
+ Process.kill("TERM", pid1)
+ Process.kill("TERM", pid2)
end
end
@@ -205,4 +202,4 @@ def safely_fork(&block)
@client.reset
FileUtils.rm(Dir.glob(File.join(@tmp_path, '*')))
end
-end
+end

0 comments on commit 728928c

Please sign in to comment.
Something went wrong with that request. Please try again.