Chef, Puppet, Ansible and also shell scripts # Example: Chef # install apache package 'apache2' do action :install end ! # start apache service 'apache2' do action :start end
"returns content including 'app'" do expect(response.body).to include('app') end end ! describe http('http://static.example.com') do it "returns content including 'static'" do expect(response.body).to include('static') end end end
Apache running? Is port 80 opened? Is MySQL running? ? whitebox blackbox Infrataster Check MySQL query response Check HTTP response target server Serverspec
Port Forwarding Infrataster::Server.define( :proxy, # name '192.168.0.0/16', # ip address vagrant: true # for vagrant VM ) ! Infrataster::Server.define( :app, # name '172.16.0.0/16', # ip address vagrant: true, # for vagrant VM from: :proxy # test from proxy )
Port Forwarding Infrataster::Server.define( :proxy, # name '192.168.0.0/16', # ip address vagrant: true # for vagrant VM ) ! Infrataster::Server.define( :app, # name '172.16.0.0/16', # ip address vagrant: true, # for vagrant VM from: :proxy # test from proxy ) Access from proxy by SSH port forwarding
it "responds content including 'Hello Sinatra'" do expect(response.body).to include('Hello Sinatra') end end describe http('http://static') do it "responds content including 'Welcome to nginx!'" do expect(response.body).to include('Welcome to nginx!') end end end
"responds content including 'Hello Sinatra'" do expect(response.body).to include('Hello Sinatra') end end describe http('http://static') do it "responds content including 'Welcome to nginx!'" do expect(response.body).to include('Welcome to nginx!') end end end Access from proxy by SSH port forwarding VirtualHost support (Host header manipulation) response is a Faraday::Response (You can check status, header too)
describe capybara('http://app') do it "responds content including 'Hello Sinatra'" do visit '/' expect(page).to have_content('Hello Sinatra') end end end
(with Host:app header) Forward from 127.0.0.1:XXXX to app:80 Listen 80 describe server(:app) do # Test from proxy server describe capybara('http://app') do it "responds content including 'Hello Sinatra'" do visit '/' expect(page).to have_content('Hello Sinatra') end end end
{ page.driver.clear_network_traffic } specify "all resources is loaded with success" do visit '/' page.driver.network_traffic.each do |req| req.response_parts.each do |res| expect(res.status).to be_between(200, 299) end end end end end
'responds uptime' do row = results.find do |r| r['Variable_name'] == 'Uptime' end expect(row['Value'].to_i).to be > 0 end end end https://github.com/ryotarai/infrataster-plugin-mysql
! All examples were filtered out; ignoring {:focus=>true} ! server 'app' from 'proxy' capybara 'http://app' responds content including 'Hello Sinatra' http 'http://app' responds content including 'Hello Sinatra' responds OK 200 responds as 'text/html' server 'proxy' http 'http://static' responds as 'text/html' responds content including 'Welcome to nginx!' … ! Finished in 17.92 seconds 11 examples, 0 failures ! Randomized with seed 12750