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
72
5分で知るGo言語
yudoufu
0
160
Other Decks in Technology
See All in Technology
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
UI State設計とテスト方針
rmakiyama
2
600
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
160
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.3k
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
270
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
140
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
820
2024年にチャレンジしたことを振り返るぞ
mitchan
0
140
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
260
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Why Our Code Smells
bkeepers
PRO
335
57k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Statistics for Hackers
jakevdp
796
220k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Scaling GitHub
holman
458
140k
Facilitating Awesome Meetings
lara
50
6.1k
We Have a Design System, Now What?
morganepeng
51
7.3k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Embracing the Ebb and Flow
colly
84
4.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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! ʘ\\٩( 'ω' )و //ʗ