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
Ruby tools for Infrastructure Engineer (hbstyle...
Search
rrreeeyyy
June 13, 2014
Technology
0
500
Ruby tools for Infrastructure Engineer (hbstyle-2014-0612)
rrreeeyyy
June 13, 2014
Tweet
Share
More Decks by rrreeeyyy
See All by rrreeeyyy
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
3.4k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.2k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
9
2.4k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
8.5k
「信頼性」を保ちつつ大規模サービスをリニューアルする / cookpad-tech-kitchen-service-embedded-sres
rrreeeyyy
11
12k
Cookpad and Prometheus
rrreeeyyy
6
20k
SRE-Lounge-8-Cookpad-Microservice-Architecture-Overview
rrreeeyyy
5
5.2k
A survey of anomaly detection methodologies for web system
rrreeeyyy
5
1.2k
Other Decks in Technology
See All in Technology
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
580
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
TypeScript、上達の瞬間
sadnessojisan
46
13k
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Visualization
eitanlees
145
15k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Designing Experiences People Love
moore
138
23k
Rails Girls Zürich Keynote
gr2m
94
13k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Transcript
Ruby tools for Infrastructure Engineer
RSpec
RSpec 4 RSpec is testing tool for the Ruby programming
language. 4 Ruby ͷςεςΟϯάϑϨʔϜϫʔΫɻ 4 Serverspec Infrataster ͷ࠷ۙͷ Infrastructure testing framework ͰΘΕ͍ͯΔɻ ࠷ۙ 3.0rc1 ͕ग़ͨɻ
Serverspec
Serverspec Infrastructure testing framework cat spec/target.example.jp/http_spec.rb require 'spec_helper' describe package('httpd')
do it { should be_installed } end 4 rspec 4 describe, it, its ... ͰςετΛॻ͍͍ͯ͘ 4 http://serverspec.org/resource_types.html
Serverspec Run test $ rake spec /usr/bin/ruby -S rspec spec/www.example.jp/httpd_spec.rb
...... : 4 rake?
Rake 4 Ruby Ϗϧυπʔϧ 4 Make ͱΑ͘ࣅͨػೳ͕͔ͭ͑Δ 4 "λεΫ" ͱ͍͏جຊ୯ҐͰԿ͔Λ࣮ߦ͢Δ
Rakefile require 'rake' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern =
'spec/*/*_spec.rb' end task :default => :spec 4 spec ͱ͍͏໊લͷλεΫ͕ఆٛ͞Ε͍ͯΔ 4 λεΫҰཡ rake -T ͰݟΕΔ
spec_helper.rb 4 ςετͰ͏ڞ௨ͷઃఆΛॻ͘ 4 serverspec Ͱɺserverspec Ͱ͏ sudo password
ssh ઌ host ͷఆ͕ٛॻ͔Ε͍ͯΔ 4 host = File.basename(Pathname.new(file).dirname) 4 σϑΥϧτͩͱσΟϨΫτϦͷ໊લ͕ϗετ໊ʹͳΔ 8 -rw-r--r-- 1 staff 848 6 12 18:32 spec_helper.rb 0 drwxr-xr-x 3 staff 102 6 12 18:32 target.example.com ← ͜Ε
Tips
Tips Rake ӽ͠ʹ Rspec ͷҾΛ͢ rake spec SPEC_OPTS="--format documentation" ৗʹಉ͡Φϓγϣϯ͕͍͍ͨ
echo "--color" >> .rspec # ৭͕ͭ͘ 4 ੲ spec.opts ͩͬͨ
ग़ྗϑΥʔϚοτ 4 --format 4 documentation 4 progress 4 html
ςετͷϑΟϧλϦϯά 4 ৭ʑͳঢ়ଶʹΑ͍ͬͯͨ͠/ͨ͘͠ͳ͍ςετ͕͋Δ 4 --tag ΦϓγϣϯΛ͏ 4 --tag <tag_name> 4
<tag_name> ͷ͍͍ͭͯΔςετͷΈ࣮ߦ͢Δ 4 --tag ~<tag_name> 4 <tag_name> ͷ͍͍ͭͯΔςετΛআ֎͢Δ 4 ଞʹ৭ʑग़དྷΔ
Usage rake spec SPEC_OPTS="--format documentation --tag ~web" 4 ͜Μͳײ͡Ͱ͏ ࣮ࡍʹҊ݅Ͱ͍ͬͯΔ༷ࢠΛ͝հ
Enjoy test! and reduce mistakes!