add local specinfra backend to integration tests

This commit is contained in:
Dominik Richter 2015-09-14 16:08:01 +02:00
parent b0203127ab
commit cafa45e84e

View file

@ -2,33 +2,46 @@ require 'minitest/autorun'
require 'minitest/spec' require 'minitest/spec'
require 'vulcano/backend' require 'vulcano/backend'
conf = Vulcano::Backend.target_config({}) backends = {
backend_class = Vulcano::Backend.registry['local'] :local => proc {
backend = backend_class.new(conf) backend_conf = Vulcano::Backend.target_config({})
backend_class = Vulcano::Backend.registry['local']
backend_class.new(backend_conf)
},
:specinfra_local => proc {
backend_conf = Vulcano::Backend.target_config({
'backend' => 'exec',
})
backend_class = Vulcano::Backend.registry['specinfra']
backend_class.new(backend_conf)
},
}
describe 'run_command' do backends.each do |type, get_backend|
let(:backend_conf) { Vulcano::Backend.target_config({}) } puts "run on backend #{type.to_s}"
let(:backend_class) { Vulcano::Backend.registry['local'] }
let(:backend) { backend_class.new(backend_conf) }
it 'can echo commands' do describe 'run_command' do
res = backend.run_command('echo hello world') let(:backend) { get_backend.call() }
res.stdout.must_equal("hello world\n")
res.stderr.must_equal('')
res.exit_status.must_equal(0)
end
it 'can echo commands to stderr' do it 'can echo commands' do
res = backend.run_command('>&2 echo hello world') res = backend.run_command('echo hello world')
res.stdout.must_equal('') res.stdout.must_equal("hello world\n")
res.stderr.must_equal("hello world\n") res.stderr.must_equal('')
res.exit_status.must_equal(0) res.exit_status.must_equal(0)
end end
it 'prints a correct exit status' do it 'can echo commands to stderr' do
res = backend.run_command('exit 123') res = backend.run_command('>&2 echo hello world')
res.stdout.must_equal("") res.stdout.must_equal('')
res.stderr.must_equal("") res.stderr.must_equal("hello world\n")
res.exit_status.must_equal(123) res.exit_status.must_equal(0)
end
it 'prints a correct exit status' do
res = backend.run_command('exit 123')
res.stdout.must_equal('')
res.stderr.must_equal('')
res.exit_status.must_equal(123)
end
end end
end end