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.6k
Glint
RedDotRubyConf 2013
http://www.reddotrubyconf.com/
Kentaro Kuribayashi
June 07, 2013
Tweet
Share
More Decks by Kentaro Kuribayashi
See All by Kentaro Kuribayashi
Bidirectional Quadratic Voting Leveraging Issue-Based Matching
kentaro
2
320
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
230
「始め方」の始め方 / How to Start Starting Things
kentaro
5
840
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.2k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
480
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
5.1k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
41
22k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
15
16k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
7
1.5k
Other Decks in Technology
See All in Technology
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
13
3.6k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
ハイテク休憩
sat
PRO
2
140
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
260
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
330
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
170
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
520
Amazon Kendra GenAI Index 登場でどう変わる? 評価から学ぶ最適なRAG構成
naoki_0531
0
100
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
0
150
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Raft: Consensus for Rubyists
vanstee
137
6.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Thoughts on Productivity
jonyablonski
67
4.4k
Faster Mobile Websites
deanohume
305
30k
4 Signs Your Business is Dying
shpigford
181
21k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
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