Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Glint

 Glint

RedDotRubyConf 2013
http://www.reddotrubyconf.com/

Kentaro Kuribayashi

June 07, 2013
Tweet

More Decks by Kentaro Kuribayashi

Other Decks in Technology

Transcript

  1. • Cache servers • Storage servers • Job queue/workers •

    Other applications (e.g. external APIs) • etc.
  2. • Launch servers in advance (e.g mysql/pg with Rails) •

    Stub out connections to the servers (e.g. stub/mock in RSpec) To deal with it, you may:
  3. Launching Servers • We don’t always need such many servers

    • It can be waste of limited resources of our daily- used local machine
  4. Stubbing out Connections • Efficient way to test apps that

    depends on external components • But we can’t tell whether or not our apps work well indeed against real servers
  5. Glint is a library which allows you to fire arbitrary

    TCP servers to help you test your codes against those real servers without stubbing out.
  6. 1. Fork a child process for a TCP server 2.

    Find an empty port for the server 3. Exec the server program using the port 4. Destroy the child process when it’s no longer needed
  7. 1. Fork a child process for a TCP server 2.

    Find an empty port for the server 3. Exec the server program using the port 4. Destroy the child process when it’s no longer needed
  8. http://ruby-doc.org/core-2.0/ObjectSpace.html “ObjectSpace also provides support for object finalizers, procs that

    will be called when a specific object is about to be destroyed by garbage collection.”
  9. • Stubbing out external connection may cause some problems •

    Glint allows you to easily fire up TCP servers as you need • Patches are welcome! Recap