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
530
Ruby tools for Infrastructure Engineer (hbstyle-2014-0612)
rrreeeyyy
June 13, 2014
Tweet
Share
More Decks by rrreeeyyy
See All by rrreeeyyy
Rethinking Incident Response: Context-Aware AI in Practice
rrreeeyyy
1
150
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
230
An Efficient Incident Response Training with AI / SRE NEXT 2024 Sponsor Session
rrreeeyyy
1
5.2k
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
4
2.4k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
10
2.6k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
8.8k
「信頼性」を保ちつつ大規模サービスをリニューアルする / cookpad-tech-kitchen-service-embedded-sres
rrreeeyyy
11
12k
Cookpad and Prometheus
rrreeeyyy
6
21k
SRE-Lounge-8-Cookpad-Microservice-Architecture-Overview
rrreeeyyy
5
5.5k
Other Decks in Technology
See All in Technology
60以上のプロダクトを持つ組織における開発者体験向上への取り組み - チームAPIとBackstageで構築する組織の可視化基盤 - / sre next 2025 Efforts to Improve Developer Experience in an Organization with Over 60 Products
vtryo
2
510
united airlines ™®️ USA Contact Numbers: Complete 2025 Support Guide
flyunitedhelp
1
440
サイバーエージェントグループのSRE10年の歩みとAI時代の生存戦略
shotatsuge
4
510
スタートアップに選択肢を 〜生成AIを活用したセカンダリー事業への挑戦〜
nstock
0
270
改めてAWS WAFを振り返る~業務で使うためのポイント~
masakiokuda
2
310
敢えて生成AIを使わないマネジメント業務
kzkmaeda
2
470
OpenTelemetryセマンティック規約の恩恵とMackerel APMにおける活用例 / SRE NEXT 2025
mackerelio
2
900
マルチプロダクト環境におけるSREの役割 / SRE NEXT 2025 lunch session
sugamasao
1
110
CDK Vibe Coding Fes
tomoki10
0
310
公開初日に Gemini CLI を試した話や FFmpeg と組み合わせてみた話など / Gemini CLI 初学者勉強会(#AI道場)
you
PRO
0
210
Claude Code に プロジェクト管理やらせたみた
unson
7
4.7k
How to Quickly Call American Airlines®️ U.S. Customer Care : Full Guide
flyaahelpguide
0
160
Featured
See All Featured
Making Projects Easy
brettharned
116
6.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Done Done
chrislema
184
16k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Gamification - CAS2011
davidbonilla
81
5.4k
Into the Great Unknown - MozCon
thekraken
40
1.9k
GitHub's CSS Performance
jonrohan
1031
460k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Building Adaptive Systems
keathley
43
2.7k
Six Lessons from altMBA
skipperchong
28
3.9k
Being A Developer After 40
akosma
90
590k
The Cult of Friendly URLs
andyhume
79
6.5k
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!