Subscribed unsubscribe Subscribe Subscribe

Kentaro Kuribayashi's blog

Software Engineering, Management, Books, and Daily Journal.

Glint: Fires arbitrary TCP server processs for tests

id:tokuhirom's Test::TCP is very useful to test code against real arbitrary TCP server processes. I've wanted it for Ruby for long time. Now I started feeling I really need it, I ported it to Ruby.

server = Glint::Server.new do |port|
  # Execute target server process
  exec command, args
end
server.start

# Test your code against the server process
client = MyClient.new('127.0.0.1', server.port)
client.do_something

exit
# The process executed above will be shutdown here.

This library supports only server execution so far different from the orignal Perl module. I'm wondering whether I should add utility method and support for client dispatching or not.