forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
require_relative './evm_test_helper' | ||
|
||
if defined?(RSpec) | ||
namespace :test do | ||
task :initialize do | ||
if ENV['RAILS_ENV'] && ENV["RAILS_ENV"] != "test" | ||
warn "Warning: RAILS_ENV is currently set to '#{ENV["RAILS_ENV"]}'. Forcing to 'test' for this run." | ||
namespace :test do | ||
task :initialize do | ||
if ENV['RAILS_ENV'] && ENV["RAILS_ENV"] != "test" | ||
warn "Warning: RAILS_ENV is currently set to '#{ENV["RAILS_ENV"]}'. Forcing to 'test' for this run." | ||
end | ||
ENV['RAILS_ENV'] = "test" | ||
Rails.env = 'test' if defined?(Rails) | ||
|
||
ENV['VERBOSE'] ||= "false" | ||
end | ||
ENV['RAILS_ENV'] = "test" | ||
Rails.env = 'test' if defined?(Rails) | ||
|
||
ENV['VERBOSE'] ||= "false" | ||
end | ||
desc "Verifies that the rails environment does not require DB access" | ||
task :verify_no_db_access_loading_rails_environment do | ||
if Rake::Task['environment'].already_invoked | ||
raise "Failed to verify database access when loading rails because the 'environment' rake task has already been invoked!" | ||
end | ||
|
||
desc "Verifies that the rails environment does not require DB access" | ||
task :verify_no_db_access_loading_rails_environment do | ||
if Rake::Task['environment'].already_invoked | ||
raise "Failed to verify database access when loading rails because the 'environment' rake task has already been invoked!" | ||
EvmRakeHelper.with_dummy_database_url_configuration do | ||
begin | ||
puts "** Confirming rails environment does not connect to the database" | ||
Rake::Task['environment'].invoke | ||
rescue ActiveRecord::NoDatabaseError | ||
STDERR.write "Detected Rails environment trying to connect to the database! Check the backtrace for an initializer trying to access the database.\n\n" | ||
raise | ||
end | ||
end | ||
end | ||
|
||
EvmRakeHelper.with_dummy_database_url_configuration do | ||
begin | ||
puts "** Confirming rails environment does not connect to the database" | ||
Rake::Task['environment'].invoke | ||
rescue ActiveRecord::NoDatabaseError | ||
STDERR.write "Detected Rails environment trying to connect to the database! Check the backtrace for an initializer trying to access the database.\n\n" | ||
raise | ||
end | ||
task :setup_db => [:initialize, :setup_region] do | ||
reset_task = defined?(ENGINE_ROOT) ? 'app:evm:db:reset' : 'evm:db:reset' | ||
Rake::Task[reset_task].invoke | ||
end | ||
end | ||
|
||
task :setup_db => [:initialize, :setup_region] do | ||
reset_task = defined?(ENGINE_ROOT) ? 'app:evm:db:reset' : 'evm:db:reset' | ||
Rake::Task[reset_task].invoke | ||
end | ||
task :setup_region do | ||
ENV["REGION"] ||= (rand(99) + 1).to_s # Ensure we have a random, non-0, region | ||
puts "** Preparing database with REGION #{ENV["REGION"]}" | ||
end | ||
|
||
task :spec_deps => [:initialize, 'evm:compile_sti_loader'] | ||
|
||
task :setup_region do | ||
ENV["REGION"] ||= (rand(99) + 1).to_s # Ensure we have a random, non-0, region | ||
puts "** Preparing database with REGION #{ENV["REGION"]}" | ||
task :setup do | ||
test_suite = ENV["TEST_SUITE"] || "vmdb" | ||
Rake::Task["test:#{test_suite}:setup"].invoke | ||
end | ||
end | ||
|
||
task :spec_deps => [:initialize, 'evm:compile_sti_loader'] | ||
task :default => :test | ||
|
||
task :setup do | ||
task :test do | ||
test_suite = ENV["TEST_SUITE"] || "vmdb" | ||
Rake::Task["test:#{test_suite}:setup"].invoke | ||
Rake::Task["test:#{test_suite}"].invoke | ||
end | ||
end | ||
|
||
task :default => :test | ||
|
||
task :test do | ||
test_suite = ENV["TEST_SUITE"] || "vmdb" | ||
Rake::Task["test:#{test_suite}"].invoke | ||
end | ||
end # ifdef |
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,15 +1,15 @@ | ||
require_relative './evm_test_helper' | ||
|
||
if defined?(RSpec) | ||
namespace :test do | ||
desc "Run all specs tagged 'providers_common'" | ||
RSpec::Core::RakeTask.new(:providers_common => :spec_deps) do |t| | ||
EvmTestHelper.init_rspec_task(t, ['--tag', 'providers_common']) | ||
namespace :test do | ||
desc "Run all specs tagged 'providers_common'" | ||
RSpec::Core::RakeTask.new(:providers_common => :spec_deps) do |t| | ||
EvmTestHelper.init_rspec_task(t, ['--tag', 'providers_common']) | ||
|
||
if defined?(ENGINE_ROOT) | ||
t.rspec_opts += ["--exclude-pattern", "manageiq/spec/tools/**/*_spec.rb"] | ||
t.pattern = "manageiq/spec/**/*_spec.rb" | ||
if defined?(ENGINE_ROOT) | ||
t.rspec_opts += ["--exclude-pattern", "manageiq/spec/tools/**/*_spec.rb"] | ||
t.pattern = "manageiq/spec/**/*_spec.rb" | ||
end | ||
end | ||
end | ||
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