21. 構成
Microsoft Azure
Visual Studio Online
Cross platform build
Execute test via SSH
Test results
Test server installed Serverspec Test target
Client machine
for control
36. 3. Serverspecを準備する[~]$ # Test server installed Serverspecに準備を施す
[~]$ vi spec/serverspec-work.cloudapp.net/sample_spec.rb
require 'spec_helper‘
describe package('httpd'), :if => os[:family] == 'redhat' do
it { should be_installed }
end
describe package('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
describe service('httpd'), :if => os[:family] == 'redhat' do
it { should be_enabled }
it { should be_running }
end
describe service('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_enabled }
it { should be_running }
end
describe service('org.apache.httpd'), :if => os[:family] == 'darwin' do
it { should be_enabled }
it { should be_running }
end
describe port(22) do
it { should be_listening }
end
describe port(80) do
it { should be_listening }
end
38. 3. Serverspecを準備する[~]$ # とりあえず、実行してみる
Port “22“
should be listening
Port ”80“
should be listening (FAILED - 1)
Failures:
1) Port "80" should be listening
On host `serverspec-work.cloudapp.net‘
Failure/Error: it { should be_listening }
expected Port "80" to be listening
sudo -p 'Password: ' /bin/sh -c netstat -tunl | grep -- :80
# ./spec/serverspec-work.cloudapp.net/sample_spec.rb:31:in `block (2 levels) in
<top (required)>‘
Finished in 0.25522 seconds (files took 8.62 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./spec/serverspec-work.cloudapp.net/sample_spec.rb:31 # Port "80" should be
listening
48. 5. VSO-Agentを実行する
[~]$ node agent/vsoagent
Enter alternate username > [Alternate authenthication credentials]で設定し
たUser name
Enter alternate password > [Alternate authenthication credentials]で設定し
たPassword
Enter server url > [あなたのVisual Studio OnlineのURL] e.g.
https://sample.visualstudio.com/
Enter agent name (enter sets xxxx) >
Enter agent pool name (enter sets default) >
successful connect as あなたの名前