Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Glint
Kentaro Kuribayashi
June 07, 2013
Technology
2
3.4k
Glint
RedDotRubyConf 2013
http://www.reddotrubyconf.com/
Kentaro Kuribayashi
June 07, 2013
Tweet
Share
More Decks by Kentaro Kuribayashi
See All by Kentaro Kuribayashi
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
72
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
3
1k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
16
7.7k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
10
4.6k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
5
880
GMOペパボが考えるこれからのサービス開発 / Toward The Next Service Development Era
kentaro
1
1.1k
IoTシステムの双方向データフローにおける設計と実装の複雑さを解消する手法の提案 / Master's Thesis Examination
kentaro
0
630
双方向データフローに基づくインテリジェントなIoTシステムを実現するための研究 / My Research Plan for the Doctoral Course
kentaro
0
550
Elixirで構成された3層構造からなるIoTシステムにおける分散機械学習・推論実行基盤へ向けて / Toward a Distributed Machine Learning Infrastructure for IoT Systems in Elixir
kentaro
1
760
Other Decks in Technology
See All in Technology
もし本番ネットワークをまるごと仮想環境に”コピー”できたらうれしいですか? / janog51
corestate55
0
380
証明書って何だっけ? 〜AWSの中間CA移行に備える〜
minorun365
3
2.1k
金属加工屋の営業マンがSTマイクロで・・・
usashirou
0
160
Multi-Cloud Gatewayでデータを統治せよ!/ Data Federation with MCG
tutsunom
1
280
PCL (Point Cloud Library)の基本となぜ点群処理か_2023年_第2版.pdf
cvmlexpertguide
0
170
NGINXENG JP#2 - 1-NGINX-エンジニアリング勉強会-きょうの見どころ
hiropo20
0
110
re:Inventで発表があったIoT事例の紹介と考察
kizawa2020
0
180
AI Builderについて
miyakemito
0
900
S3とCloudWatch Logsの見直しから始めるコスト削減 / Cost saving S3 and CloudWatch Logs
shonansurvivors
0
240
NGINXENG JP#2 - 2-NGINXの動作の詳細
hiropo20
1
140
API連携に伴う規制と対応 / Regulations and responses to API linkage
moneyforward
0
160
データベースの発表には RDBMS 以外もありますよ
maroon1st
0
240
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
12
1.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
317
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
29
7.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
Scaling GitHub
holman
453
140k
Intergalactic Javascript Robots from Outer Space
tanoku
261
26k
Atom: Resistance is Futile
akmur
256
24k
What’s in a name? Adding method to the madness
productmarketing
12
1.9k
Robots, Beer and Maslow
schacon
154
7.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
152
13k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
6
840
Fashionably flexible responsive web design (full day workshop)
malarkey
396
63k
Transcript
Glint Fires arbitrary TCP servers http://www.flickr.com/photos/tjblackwell/3107540997/
@kentaro Software engineer to build technical basis Rubyist / Perl
Monger Kentaro Kuribayashi paperboy&co.
None
Problem
Applications often consists of various components
• Cache servers • Storage servers • Job queue/workers •
Other applications (e.g. external APIs) • etc.
• 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:
Launching Servers • We don’t always need such many servers
• It can be waste of limited resources of our daily- used local machine
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
Solution
Glint
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.
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
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
Basic usage
With RSpec
servers/memcached.rb
spec_helper.rb
**_spec.rb
App + External App
initializer/**.rb
**_spec.rb
TCP server + TCP server
Fluentd::Integration
How Glint Cleans up the Servers
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.”
glint/server.rb Glint::Server#stop
• Stubbing out external connection may cause some problems •
Glint allows you to easily fire up TCP servers as you need • Patches are welcome! Recap