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
560
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
640
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
280
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
4k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
25
16k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
14
14k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
6
1.2k
GMOペパボが考えるこれからのサービス開発 / Toward The Next Service Development Era
kentaro
1
1.6k
IoTシステムの双方向データフローにおける設計と実装の複雑さを解消する手法の提案 / Master's Thesis Examination
kentaro
0
850
Other Decks in Technology
See All in Technology
庁舎DX推進事例集
senryakuka
0
1.6k
書を捨てよ、現場へ出よう
nwiizo
11
8.7k
SwiftUIのpropertyWrapperをふんわり理解する
jambo_develop_team
0
110
『QAという人』が必要ではなく、『QAという技術』が必要
sadonosake
2
250
Node-AI のリッチな WEB フロントエンドを支える技術
nenonaninu
2
970
ECS on FargateへのSeekable OCI導入レポート
iwamot
0
260
B+木入門:PHPで理解する データベースインデックスの仕組み/b-plus-tree-101
hanhan1978
5
2.7k
Beginner's Guide to Partitioning vs. Sharding in Postgres | Claire Giordano | Nordic PGDay 2024
clairegiordano
0
210
Tohoku.Tech #1 「Cursorを使ったRaspberry Piの開発」by ねこまた
jun2882
0
150
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
4
34k
10年モノのレガシーPHPアプリケーションを移植しきるまでの泥臭くも長い軌跡 / legacy-php-app-migration
toshimaru
0
690
プレイヤーとしてのチームのテスト力UP/Improving team skills for testing
goyoki
2
220
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
10
810
Mobile First: as difficult as doing things right
swwweet
215
8.5k
Build your cross-platform service in a week with App Engine
jlugia
223
17k
Designing the Hi-DPI Web
ddemaree
275
33k
Faster Mobile Websites
deanohume
296
30k
Embracing the Ebb and Flow
colly
78
4.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
StorybookのUI Testing Handbookを読んだ
zakiyama
10
4.4k
How STYLIGHT went responsive
nonsquared
92
4.7k
Testing 201, or: Great Expectations
jmmastey
27
6.3k
Building Your Own Lightsaber
phodgson
97
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