mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
add simple localized test environment
This commit is contained in:
parent
1dbcac33f5
commit
ba1750e496
3 changed files with 46 additions and 0 deletions
17
test/runner/local_test.d/.kitchen.yml
Normal file
17
test/runner/local_test.d/.kitchen.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
|
||||
provisioner:
|
||||
name: shell
|
||||
data_path: ../../../.
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-14.04
|
||||
- name: ubuntu-12.04
|
||||
- name: ubuntu-10.04
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
attributes:
|
8
test/runner/local_test.d/bootstrap.sh
Executable file
8
test/runner/local_test.d/bootstrap.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
apt-get update && apt-get -y install ruby ruby-dev gem gcc
|
||||
gem install bundler
|
||||
|
||||
cd /tmp/kitchen/data
|
||||
bundle install
|
||||
bundle exec ruby -I lib test/runner/local_test.d/test.rb
|
21
test/runner/local_test.d/test.rb
Normal file
21
test/runner/local_test.d/test.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'minitest/autorun'
|
||||
require 'minitest/spec'
|
||||
require 'vulcano/backend'
|
||||
|
||||
conf = Vulcano::Backend.target_config({})
|
||||
backend_class = Vulcano::Backend.registry['local']
|
||||
backend = backend_class.new(conf)
|
||||
|
||||
describe 'run_command' do
|
||||
let(:backend_conf) { Vulcano::Backend.target_config({}) }
|
||||
let(:backend_class) { Vulcano::Backend.registry['local'] }
|
||||
let(:backend) { backend_class.new(backend_conf) }
|
||||
|
||||
it 'can echo commands' do
|
||||
res = backend.run_command('echo hello world')
|
||||
res.stdout.must_equal("hello world\n")
|
||||
res.stderr.must_equal('')
|
||||
res.exit_status.must_equal(0)
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue