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
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
140
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
140
あなたの知らない Function.prototype.toString() の世界
mizdra
PRO
4
1.3k
OCI Vault 概要
oracle4engineer
PRO
0
9.8k
型チェック 速度改善 奮闘記⌛
tocomi
1
190
Chasing the White Whale of Open Source - ROI
mrbobbytables
0
120
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
340
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
210
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
430
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
490
Mastering Quickfix
daisuzu
1
350
SAP Community and Developer Update
sygyzmundovych
0
350
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
A Philosophy of Restraint
colly
203
16k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
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! ʘ\\٩( 'ω' )و //ʗ