forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust specs for cleaner testing on Travis.
Also, provide default rake tasks for lib and vmdb directory for testing.
- Loading branch information
Showing
9 changed files
with
77 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace :test do | ||
task :setup_lib # NOOP - Stub for consistent CI testing | ||
|
||
desc "Run all lib specs and tests except MiqDisk tests" | ||
task :lib => [:spec, :test] | ||
end | ||
|
||
task :default => 'test:lib' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module EvmTestHelper | ||
def self.run_rake_via_shell(rake_command, env = {}) | ||
cmd = "bundle exec rake #{rake_command}" | ||
cmd << " --trace" if Rake.application.options.trace | ||
_pid, status = Process.wait2(Kernel.spawn(env, cmd, :chdir => Rails.root)) | ||
exit(status.exitstatus) if status.exitstatus != 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,17 @@ | ||
require_relative "./evm_test_helper" | ||
|
||
namespace :evm do | ||
namespace :test do | ||
task :setup_migrations => 'evm:test:initialize' do | ||
puts "** Preparing migrations database" | ||
run_rake_via_shell("evm:db:destroy") | ||
end | ||
|
||
namespace :complete_migrations do | ||
task :up do | ||
puts "** Migrating all the way up" | ||
run_rake_via_shell("db:migrate") | ||
EvmTestHelper.run_rake_via_shell("db:migrate", "VERBOSE" => ENV["VERBOSE"] || "false") | ||
end | ||
|
||
task :down do | ||
puts "** Migrating all the way down" | ||
run_rake_via_shell("db:migrate VERSION=0") | ||
EvmTestHelper.run_rake_via_shell("db:migrate", "VERSION" => "0", "VERBOSE" => ENV["VERBOSE"] || "false") | ||
end | ||
end | ||
end | ||
end | ||
|
||
def run_rake_via_shell(rake_command) | ||
cmd = "rake #{rake_command}" | ||
cmd << " --trace" if Rake.application.options.trace | ||
pid, status = Process.wait2(Kernel.spawn(cmd, :chdir => Rails.root)) | ||
exit(status.exitstatus) if status.exitstatus != 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace :test do | ||
task :setup_db do | ||
ENV['RAILS_ENV'] ||= "test" | ||
Rails.env = ENV['RAILS_ENV'] if defined?(Rails) | ||
|
||
ENV['VERBOSE'] ||= "false" | ||
Rake::Task['evm:db:reset'].invoke | ||
end | ||
|
||
task :setup_vmdb => :setup_db | ||
task :setup_migrations => :setup_db | ||
task :setup_replication => 'evm:test:setup_replication' | ||
task :setup_automation => :setup_db | ||
|
||
desc "Runs all specs except migrations, replication, automation, and requests" | ||
task :vmdb => 'spec:evm:backend' | ||
|
||
desc "Runs all migration specs" | ||
task :migrations => ['spec:evm:migrations:down', 'evm:test:complete_migrations:down', 'spec:evm:migrations:up', 'evm:test:complete_migrations:up'] | ||
|
||
desc "Runs all replication specs" | ||
task :replication => 'spec:evm:replication' | ||
|
||
desc "Runs all automation specs" | ||
task :automation => 'spec:evm:automation' | ||
end | ||
|
||
task :default => 'test:vmdb' |