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
3.9k
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
70
5分で知るGo言語
yudoufu
0
160
Other Decks in Technology
See All in Technology
管理画面とユーザー機能の調和を取り戻す!~クエリパフォーマンス改善の成功物語~ / Restore harmony between administrative and user functions!
minisera
1
260
地域DXにおけるGrafana活用事例
wacky
0
380
Road to Single Activity Uncovered
yurihondo
0
110
ラブグラフ紹介資料 〜プロダクト解体新書〜 / Lovegraph Product Deck
lovegraph
0
14k
RSGT Walk Through
kawaguti
PRO
2
380
AWS Lambda と Amazon SQS で「わかった気になれる」FreeRTOS 入門
soracom
PRO
2
140
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
48k
RDS for Db2 データ移行編 - Part2:S3経由のバックアップ・リストアでデータ移行 /20241011-RDSforDb2-dojo
mayumihirano
0
140
Demystifying Vite Internals
nozomuikuta
3
250
SageMaker学習のツボ / The Key Points of Learning SageMaker
cmhiranofumio
0
280
VueとViteで作るUIコンポーネントライブラリ ~デザインシステムとプロダクトの理想的な分離を目指して~ / 20241019_cloudsign_VueFesJapan2024_1
bengo4com
8
3.5k
안드로이드 기술 이력서의 최소 조건
pluu
1
840
Featured
See All Featured
A Tale of Four Properties
chriscoyier
156
22k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Making Projects Easy
brettharned
115
5.9k
Bash Introduction
62gerente
608
210k
A designer walks into a library…
pauljervisheath
202
24k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Designing for humans not robots
tammielis
249
25k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.6k
Done Done
chrislema
181
16k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.6k
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! ʘ\\٩( 'ω' )و //ʗ