Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Glint
Search
Kentaro Kuribayashi
June 07, 2013
Technology
2
3.5k
Glint
RedDotRubyConf 2013
http://www.reddotrubyconf.com/
Kentaro Kuribayashi
June 07, 2013
Tweet
Share
More Decks by Kentaro Kuribayashi
See All by Kentaro Kuribayashi
「始め方」の始め方 / How to Start Starting Things
kentaro
5
650
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
770
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
340
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
4.3k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
35
20k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
15
15k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
6
1.3k
GMOペパボが考えるこれからのサービス開発 / Toward The Next Service Development Era
kentaro
1
1.6k
IoTシステムの双方向データフローにおける設計と実装の複雑さを解消する手法の提案 / Master's Thesis Examination
kentaro
0
870
Other Decks in Technology
See All in Technology
Real World Type Puzzle and Code Generation
yukukotani
4
640
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
12
7.9k
Databricksの生成AI戦略
taka_aki
1
370
iThome2024 Wailing Wall of Enterprise Security
notsurprised
0
290
SLOいつ決めましょう?
abnoumaru
3
580
サービス開発におけるVue3とTypeScriptの親和性について
tsukuha
10
1.8k
Dungeons and Dragons and Rails
joelq
0
230
データ分析力を高めるSQL研修サービス『SQL Everyone』
hikarut
1
390
大規模言語モデル (LLM)における低精度数値表現
pfn
PRO
3
820
QAエンジニアが伝えたい品質保証の羅針盤 / Compass for Quality Assurance
mii3king
2
330
エムスリーQAチーム紹介資料 / Introduction of M3 QA Team
m3_engineering
1
320
Google Cloudを組織(企業)で運用する時のベストプラクティス × 健康の環境分離戦略 #まるクラ勉強会
yasumuusan
0
170
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
242
1.2M
Producing Creativity
orderedlist
PRO
338
39k
The Invisible Side of Design
smashingmag
294
49k
The Power of CSS Pseudo Elements
geoffreycrofte
62
5k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
What’s in a name? Adding method to the madness
productmarketing
PRO
17
2.7k
Designing the Hi-DPI Web
ddemaree
276
33k
Side Projects
sachag
451
41k
Building Effective Engineering Teams - LeadDev
addyosmani
33
1.9k
Rebuilding a faster, lazier Slack
samanthasiow
74
8.3k
Music & Morning Musume
bryan
41
5.6k
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