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-2014-0612)
Search
rrreeeyyy
June 13, 2014
Technology
0
490
Ruby tools for Infrastructure Engineer (hbstyle-2014-0612)
rrreeeyyy
June 13, 2014
Tweet
Share
More Decks by rrreeeyyy
See All by rrreeeyyy
カンファレンスから見る SRE トレンド 2024 / SRE Trends from Conferences in 2024 #SRE_Findy
rrreeeyyy
3
1.7k
信頼性の育て方 / mackerel-meetup-15
rrreeeyyy
9
2.1k
SRE の歩き方・進め方 / sre-walk-through-procedure
rrreeeyyy
0
8.3k
「信頼性」を保ちつつ大規模サービスをリニューアルする / cookpad-tech-kitchen-service-embedded-sres
rrreeeyyy
11
11k
Cookpad and Prometheus
rrreeeyyy
6
20k
SRE-Lounge-8-Cookpad-Microservice-Architecture-Overview
rrreeeyyy
5
5k
A survey of anomaly detection methodologies for web system
rrreeeyyy
5
1.1k
エンジニアリングをちゃんとやる あるいは 人類の平和 について / wsa02-rrreeeyyy
rrreeeyyy
13
2.8k
「自立」したWebシステムを創る。自分の好きなことをする世界を目指して。/ ipsj-one-2018-rrreeeyyy
rrreeeyyy
3
1.7k
Other Decks in Technology
See All in Technology
AWS学習者向けにAzureの解説スライドを作成した話
handy
3
220
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
2.2k
LangSmith入門―トレース/評価/プロンプト管理などを担うLLMアプリ開発プラットフォーム
os1ma
5
790
Microsoft Intune 勉強会 第 2 回目
tamaiyutaro
2
510
今日からできる!簡単 .NET 高速化 Tips -2024 edition-
xin9le
7
4.8k
GrafanaMeetup_AmazonManagedGrafanaのアクセス制御機能とマルチテナント環境下でのアクセス制御について
daitak
0
470
Grafana x PagerDuty Better Together
jacopen
1
330
さらばあのボタンとは言わせない SORACOM LTE-M Button powerd by AWSをまだ使えるようにした(前編?)
miura55
0
110
リテール金融(キャッシュレス・ネット銀行・ネット証券)の競争環境と経済圏
8maki
0
1.8k
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
4
950
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
37k
パスワードを保存しますか?
hanacchi
0
210
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
GraphQLとの向き合い方2022年版
quramy
33
12k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
A Tale of Four Properties
chriscoyier
153
22k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Optimizing for Happiness
mojombo
370
69k
Designing the Hi-DPI Web
ddemaree
276
33k
Navigating Team Friction
lara
179
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
The Power of CSS Pseudo Elements
geoffreycrofte
62
5k
4 Signs Your Business is Dying
shpigford
176
21k
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!