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
Casualにインフラテストへ入門した話
Search
yudoufu
May 25, 2015
Technology
2
4k
Casualにインフラテストへ入門した話
Testing Casual Talk #2 LT
yudoufu
May 25, 2015
Tweet
Share
More Decks by yudoufu
See All by yudoufu
Project開始後に導入するAssetsの自動共有
yudoufu
2
3.4k
Drink Meetup with Mercari #36 Souzoh編
yudoufu
0
990
daemontools-kobanashi
yudoufu
0
71
5分で知るGo言語
yudoufu
0
160
Other Decks in Technology
See All in Technology
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
230
複雑なState管理からの脱却
sansantech
PRO
1
150
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
140
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.3k
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
RailsConf 2023
tenderlove
29
900
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Music & Morning Musume
bryan
46
6.2k
Building Adaptive Systems
keathley
38
2.3k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Why Our Code Smells
bkeepers
PRO
334
57k
Transcript
Casualʹ Πϯϑϥςετ ೖͨ͠ Testing Casual Talks #2 LT
About me… Daichi Kamemoto (@yudoufu) • DevOps • Go! Go!
Go! ʕ◔ϖ◔ʔ • PHP / iOS (Obj-C/Swift)
Πϯϑϥ୲(Ұਓ)͕ঢ়ଶ+ৼ͍ͷ ࣗಈςετΛಋೖͨ͠ܦݧஊͱɺ ͦͷײΛ͓͠·͢ɻ
ςετಋೖҎલ • αʔόͷߏஙɾઃఆมߋશͯChefԽ • ৽ઃఆݕূαʔό(VM)ʹྲྀͯ͠νΣοΫ ̇ ƅТƅ CSPXTFSTTI
ςετಋೖҎલ 㸝 ƅТƅ • ͋ΕɺઃఆͪΐͬͱҧͬͨΑ͏ͩ • मਖ਼Λαʔόʹྲྀͯ͠͏ҰνΣοΫ
ςετಋೖҎલ • chef͕ͳίέํͯ͠ຊ൪ͱঢ়گ͕ɻɻɻ • ͏ҰVMΛ࡞Γͳ͓ͯ͠௨͠νΣοΫ 㸝 ƅТƅ
ςετಋೖҎલ • ͏ҰɻɻɻνΣοΫɻɻɻ • ͭΒ͍ Т
ChefͰਏ͍ςετ࡞ۀ • Կਓ͕Δ࡞ۀ͡Όͳ͍ • ϓϩηεͷϢʔβʔݖݶΛ֬ೝ • nginxͷઃఆΛม͑ͯϒϥβϙνϙν • VMഁغͯ͠͏Ұ࡞Δ •
ΠϯϑϥҰਓͩ͠μϒϧνΣοΫͳ͍ා͍
ʊਓਓਓਓਓਓਓਓਓਓਓʊ ʼͦ͏ͩࣗಈςετ͠Α͏ʻ ʉY^Y^Y^Y^Y^Y^Y^Y^ʉ ʂ ƅТƅ
खݩͰςετ͠Α͏ • Test-kitchen • Chef Cookbook༻ͷςετϋʔωε • VMͷىಈɺөɺςετ࣮ߦͳͲ • Serverspec
• mizzy͞Μ࡞αʔόςετπʔϧ • RSpecͰαʔό෦ͷঢ়ଶςετΛهड़ ओʹͬͪ͜
ςετڥߏங • ྆ํChef DK(Development Kit)ʹؚ·ΕͯΔ • chefίϚϯυͰcookbook࡞ͬͯΈΔͱɻɻɻ % brew cask
install virtualbox % brew cask install vagrant % brew cask install chafdk % chef generate cookbook test-cookbook
test-cookbook !"" .gitignore !"" .kitchen.yml !"" Berksfile !"" README.md !""
chefignore !"" metadata.rb !"" recipes # %"" default.rb !"" spec # !"" spec_helper.rb # %"" unit # %"" recipes # %"" default_spec.rb %"" test %"" integration !"" default # %"" serverspec # %"" default_spec.rb %"" helpers %"" serverspec %"" spec_helper.rb ࠷ॳ͔Β ͋Δʂ ࠷ॳ͔Β ͋Δʂ
࣮ߦ • .kitchen.ymlΛڥʹ͋ΘͤΔ(OSͱ͔) • *_spec.rbϑΝΠϧʹςετΛॻ͍࣮ͯߦ % cd test-cookbook % kitchen
verify # ςετ࣮ߦ
ʘaa٩ Т وʗ ࣗಈςετԽʂ ˞͜ͷޙɺαʔό$*͠·ͨ͠
ࣗಈςετԽͯ͠ಘͨͷ • ϒϥβϙνϙνΛܸୀͨ͠ • αʔόΞΫηεղͳ֬ೝ or ࠷ऴ֬ೝͷΈ • ֬ೝָ͕ʹͳͬͯվળ্͕͕ͬͨ •
ࣗͷνΣοΫϛεͷෆ͕҆ফ͑ͨ • άϦʔϯͷؾ࣋ͪΑ͞ΛຯΘͬͨ(˕´∀`)Νϋʔ
ͦͷޙɻɻɻ • ໘ͳઃఆมߋ͕͍ࠐΉ • nginxͷpath֊ຖʹCache-Control etcͷ ϔομௐ ̇ ƅТƅ
ෳࡶͳઃఆಈ࡞֬ೝ͕૿͑Δ • Serverspecঢ়ଶςετ(෦ͷ֬ೝ)ͷΈ • ઃఆϑΝΠϧςετͰ͖ͯɺಈ࡞ࣗମ ϒϥβνΣοΫ 㸝 ƅТƅ CSPXTFSTTI
ʊਓਓਓਓਓਓਓਓਓਓਓʊ ʼϒϥβϙνϙνͷ࠶དྷʻ ʉY^Y^Y^Y^Y^Y^Y^Y^ʉ 㸝 ƅТƅ ɺҰԠDVSM͚ͩͲ͞ɻɻɻ
ʊਓਓਓਓਓਓਓਓਓਓਓਓਓਓਓʊ ʼΑΖ͍͠ɺͳΒৼ͍ςετͩʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ʉ ʂ ƅТƅ
ৼ͍ςετͷࣗಈԽ • Infrataster • ΫοΫύουͷryotarai͞Μ࡞ • RSpecͰॻ͚Δৼ͍ςετπʔϧ • ࣮ࡍʹΞΫηεͯ͠ϨεϙϯεΛςετ •
CapybaraΛͬͨςετॻ͚Δ • RSpecಉ࢜ɺServerspecͱΈ߹Θ͍ͤ͢
InfratasterΛtest-kitchenͰ͏ • ຊདྷɺInfratasterαʔό֎෦͔ΒͷςετΛ ఆͨ͠ͷ • ProxyΛ͏·͘ΔػೳͳͲ͕͋Δ΄Ͳ • test-kitchenͷVMͰ͏લఏͰͳ͍ • Ͳ͏͢Δ͔ɻɻɻ
ํ๏Λ୳ͨ͠Β • IssueʹఆରԠࡦ͕ࡌͬͯͨ • https://github.com/ryotarai/infrataster/ issues/37
test-kitchenରԠํ๏ • GemfileͷՃͱɺspec_helperͰͷLoad test %"" integration !"" default # %""
serverspec # !"" Gemfile # %"" default_spec.rb %"" helpers %"" serverspec %"" spec_helper.rb
GemfileͷՃ • InfratasterΛGemfileʹՃ % ${EDITOR} test/integration/default/ serverspec/Gemfile ``` source 'https://rubygems.org'
gem 'infrataster' ```
spec_helperͰLoad • spec_helperͷ༰Λमਖ਼ % ${EDITOR} test/integration/helpers/ serverspec/spec_helper.rb ``` require 'serverspec'
require 'infrataster/rspec' set :backend, :exec Infrataster::Server.define(:app, ‘127.0.0.1') ``` ରαʔόΛ ϩʔΧϧʹ
ςετΛॻ͍࣮ͯߦ • .*_spec.rbϑΝΠϧʹςετΛॻ͍࣮ͯߦ • ServerspecͱϑΝΠϧ͕ࠞͬͯͯ͟OK % kitchen verify
ʘaa٩ Т وʗ ϩʔΧϧͰৼ͍ςετ
ৼ͍ςετʹΑͬͯಘͨͷ • ϒϥβϙνϙνΛᓲ໓ͨ͠ • ·ͣςετʹॻ͍ͯࢼ͢Α͏ʹͳͬͨ • ຊ൪өʹ҆৺ײ͕ग़͖ͯͨ • ઃఆมߋʹΑΔσάϨΛະવʹ͗͘͢ͳͬͨ •
άϦʔϯ͕·͢·͢ؾ࣋ͪΑ͘ͳͬͨ(˕´∀`)
·ͱΊɾϝϦοτͱײ • ཁ݅ɾ༷ͷ໌จԽ • σάϨΤϯόάࢭͷ҆৺ײ • νΣοΫ࡞ۀͷେ͖ͳܰݮ • ͜ΕΒͷޮՌʹجͮ͘ɺվળͷ্ •
࣮࣭4ߦͷઃఆͰςετΈࠐΊͯίεύ࠷ߴ • Πϯϑϥ୲ͷਓͥͻΓ·͠ΐ͏
Let’s Enjoy Infra Test! ʘ\\٩( 'ω' )و //ʗ