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
73
5分で知るGo言語
yudoufu
0
160
Other Decks in Technology
See All in Technology
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
RubyでKubernetesプログラミング
sat
PRO
4
160
Kotlin Multiplatformのポテンシャル
recruitengineers
PRO
2
150
Docker Desktop で Docker を始めよう
zembutsu
PRO
0
170
Evolving Architecture
rainerhahnekamp
3
250
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
680
メンバーがオーナーシップを発揮しやすいチームづくり
ham0215
2
120
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
月間60万ユーザーを抱える 個人開発サービス「Walica」の 技術スタック変遷
miyachin
1
140
Formal Development of Operating Systems in Rust
riru
1
420
My small contributions - Fujiwara Tech Conference 2025
ijin
0
1.4k
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Making the Leap to Tech Lead
cromwellryan
133
9k
GraphQLとの向き合い方2022年版
quramy
44
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
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! ʘ\\٩( 'ω' )و //ʗ