Glint

 Glint

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

23f4d5d797a91b6d17d627b90b5a42d9?s=128

Kentaro Kuribayashi

June 07, 2013
Tweet

Transcript

  1. 2.
  2. 3.
  3. 4.
  4. 6.

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

    Other applications (e.g. external APIs) • etc.
  5. 7.

    • 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:
  6. 8.

    Launching Servers • We don’t always need such many servers

    • It can be waste of limited resources of our daily- used local machine
  7. 9.

    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
  8. 10.
  9. 11.
  10. 12.

    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.
  11. 13.

    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
  12. 14.

    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
  13. 26.

    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.”
  14. 28.

    • Stubbing out external connection may cause some problems •

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