core: Getting ready to run vagrant-spec acceptance suite
This commit is contained in:
parent
36f7daa528
commit
37ffd4e477
3 changed files with 50 additions and 15 deletions
3
Gemfile
3
Gemfile
|
@ -23,8 +23,9 @@ end
|
||||||
|
|
||||||
group :plugins do
|
group :plugins do
|
||||||
gem 'vagrant-lxc', path: '.'
|
gem 'vagrant-lxc', path: '.'
|
||||||
# TODO: Disable these plugins when running acceptance specs
|
if ENV['ACCEPTANCE'] != 'true'
|
||||||
gem 'vagrant-cachier', git: 'https://github.com/fgrehm/vagrant-cachier.git'
|
gem 'vagrant-cachier', git: 'https://github.com/fgrehm/vagrant-cachier.git'
|
||||||
gem 'vagrant-pristine', git: 'https://github.com/fgrehm/vagrant-pristine.git'
|
gem 'vagrant-pristine', git: 'https://github.com/fgrehm/vagrant-pristine.git'
|
||||||
gem 'vagrant-omnibus'
|
gem 'vagrant-omnibus'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
require 'coveralls/rake/task'
|
require 'coveralls/rake/task'
|
||||||
|
|
||||||
desc 'Run all specs'
|
desc 'Run all specs'
|
||||||
task :spec => ['spec:unit', 'spec:acceptance']
|
task :spec => ['spec:set_coverage', 'spec:unit', 'spec:acceptance']
|
||||||
|
|
||||||
desc 'Default task which runs all specs with code coverage enabled'
|
desc 'Default task which runs all specs with code coverage enabled'
|
||||||
task :default => ['spec:set_coverage', 'spec:unit']
|
task :default => ['spec:set_coverage', 'spec:unit']
|
||||||
|
@ -17,17 +17,24 @@ namespace :spec do
|
||||||
ENV['COVERAGE'] = 'true'
|
ENV['COVERAGE'] = 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
def types
|
desc 'Run acceptance specs using vagrant-spec'
|
||||||
dirs = Dir['./spec/**/*_spec.rb'].map { |f| f.sub(/^\.\/(spec\/\w+)\/.*/, '\\1') }.uniq
|
task :acceptance do
|
||||||
Hash[dirs.map { |d| [d.split('/').last, d] }]
|
components = %w(
|
||||||
|
basic
|
||||||
|
network/forwarded_port
|
||||||
|
synced_folder
|
||||||
|
synced_folder/nfs
|
||||||
|
synced_folder/rsync
|
||||||
|
provisioner/shell
|
||||||
|
provisioner/puppet
|
||||||
|
provisioner/chef-solo
|
||||||
|
package
|
||||||
|
).map{|s| "provider/lxc/#{s}" }
|
||||||
|
sh "export ACCEPTANCE=true && bundle exec vagrant-spec test --components=#{components.join(' ')}"
|
||||||
end
|
end
|
||||||
types.each do |type, dir|
|
|
||||||
desc "Run the code examples in #{dir}"
|
|
||||||
RSpec::Core::RakeTask.new(type) do |t|
|
|
||||||
# Tells rspec-fire to verify if constants used really exist
|
|
||||||
ENV['VERIFY_CONSTANT_NAMES'] = '1'
|
|
||||||
|
|
||||||
t.pattern = "./#{dir}/**/*_spec.rb"
|
desc "Run unit specs with rspec"
|
||||||
end
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
||||||
|
t.pattern = "./unit/**/*_spec.rb"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
27
vagrant-spec.config.rb
Normal file
27
vagrant-spec.config.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
unless ENV['USER'] == 'vagrant'
|
||||||
|
puts 'Acceptance specs are supposed to run from one of the vagrant-lxc dev machines'
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# if defined? SimpleCov
|
||||||
|
# SimpleCov.command_name 'acceptance'
|
||||||
|
# end
|
||||||
|
|
||||||
|
if ENV['BOX_PATH'] == nil
|
||||||
|
latest = ENV.fetch('LATEST_BOXES','2014-03-11')
|
||||||
|
release = ENV.fetch('RELEASE', 'precise')
|
||||||
|
local_path ="#{File.expand_path("../", __FILE__)}/boxes/output/#{latest}/vagrant-lxc-#{release}-amd64.box"
|
||||||
|
if File.exists?(local_path)
|
||||||
|
ENV['BOX_PATH'] = local_path
|
||||||
|
else
|
||||||
|
raise 'Set $BOX_PATH to the latest released boxes'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Vagrant::Spec::Acceptance.configure do |c|
|
||||||
|
c.component_paths << "spec/acceptance"
|
||||||
|
|
||||||
|
c.provider 'lxc',
|
||||||
|
box: ENV['BOX_PATH'],
|
||||||
|
features: ['!suspend']
|
||||||
|
end
|
Loading…
Reference in a new issue