diff options
| author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2017-01-11 01:36:05 +0900 |
|---|---|---|
| committer | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2017-01-11 10:39:18 +0900 |
| commit | 79060076f217eebf8f8e5f829bd035b47adef06a (patch) | |
| tree | 7040038eb7778b7de803b8dc3a4fc9d13ad17d6a /Rakefile | |
| download | vyos-integration-test-79060076f217eebf8f8e5f829bd035b47adef06a.tar.gz vyos-integration-test-79060076f217eebf8f8e5f829bd035b47adef06a.zip | |
Initial commit
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..472f676 --- /dev/null +++ b/Rakefile @@ -0,0 +1,50 @@ +require 'rake' +require 'rspec/core/rake_task' +require 'yaml' + +spec_tasks = [] +configs = {} +tests = Dir.glob("spec/*/").map { |s| s.gsub(/spec\//, '').gsub(/\//, '') } +tests.each do |test| + spec_tasks.concat(["spec:#{test}"]) + configs[test] = YAML.load_file("spec/#{test}/config.yaml") +end + +task :spec => spec_tasks +task :all => "spec:all" + +namespace :spec do + tests.each do |test| + config = configs[test] + task test.to_sym do + puts "Running #{test} test..." + Dir.chdir("spec/#{test}") do + `vagrant up --provider=libvirt` + end + + config.keys.each do |host| + Rake::Task["spec:#{test}:#{host}"].invoke + end + + puts "Cleanup #{test} test..." + Dir.chdir("spec/#{test}") do + `vagrant destroy` + end + end + end + + tests.each do |test| + namespace test do + config = configs[test] + Dir.chdir("spec/#{test}") do + config.keys.each do |host| + RSpec::Core::RakeTask.new(host.to_sym) do |t| + ENV["TARGET_TEST"] = test + ENV["TARGET_HOST"] = host + t.pattern = "spec/#{test}/#{host}_spec.rb" + end + end + end + end + end +end |
