Recommit everything after merge disaster

pull/11574/head
Javier Torres 8 years ago
parent 41d30c39cc
commit 853732c46f

@ -116,6 +116,7 @@ group :development, :test do
gem 'rb-readline'
gem 'byebug'
gem 'rack'
gem 'zeus'
# Server
gem 'thin', require: false

@ -174,6 +174,7 @@ GEM
treetop (~> 1.4.8)
memory_profiler (0.9.6)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.2)
mocha (1.1.0)
@ -349,6 +350,8 @@ GEM
websocket (1.2.2)
xpath (0.1.4)
nokogiri (~> 1.3)
zeus (0.15.13)
method_source (>= 0.6.7)
PLATFORMS
ruby
@ -429,6 +432,7 @@ DEPENDENCIES
virtus (= 1.0.5)
vizzuality-sequel-rails (= 0.3.7)!
webrick (= 1.3.1)
zeus
BUNDLED WITH
1.11.2
1.14.2

@ -6,13 +6,18 @@ module SpecHelperHelpers
end
def clean_metadata_database
protected_tables = [:schema_migrations, :spatial_ref_sys]
Rails::Sequel.connection.tables.each do |t|
if !protected_tables.include?(t)
begin
Rails::Sequel.connection.run("TRUNCATE TABLE \"#{t}\" CASCADE")
rescue Sequel::DatabaseError => e
raise e unless e.message =~ /PG::Error: ERROR: relation ".*" does not exist/
if ENV['STELLAR'].present?
Rails::Sequel.connection.disconnect
system "#{ENV['STELLAR']} restore"
else
protected_tables = [:schema_migrations, :spatial_ref_sys]
Rails::Sequel.connection.tables.each do |t|
if !protected_tables.include?(t)
begin
Rails::Sequel.connection.run("TRUNCATE TABLE \"#{t}\" CASCADE")
rescue Sequel::DatabaseError => e
raise e unless e.message =~ /PG::Error: ERROR: relation ".*" does not exist/
end
end
end
end

@ -0,0 +1,30 @@
{
"command": "ruby -rbundler/setup -r./zeus_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {
"rake": [],
"carto_resque": ["resque"]
},
"runner": ["r"],
"console": ["c"],
"server": ["s"],
"generate": ["g"],
"destroy": ["d"],
"dbconsole": ["dbm"],
"carto_user_dbconsole": ["dbd"]
},
"test_environment": {
"carto_test": {
"test_helper": {
"test": ["rspec", "testrb"]
}
}
}
}
}
}
}

@ -0,0 +1,53 @@
require 'zeus/rails'
require_relative 'spec/support/redis'
require_relative 'spec/helpers/spec_helper_helpers'
class CustomPlan < Zeus::Rails
include SpecHelperHelpers
def carto_test
# Disable before suite hooks
ENV['PARALLEL'] = 'true'
# Clean up at least sometimes
drop_leaked_test_user_databases
# Start redis server
CartoDB::RedisTest.up
if ENV['TURBO']
clean_redis_databases
clean_metadata_database
else
RSpec.configure do |config|
config.before(:all) do
# Clean redis
clean_redis_databases
clean_metadata_database
end
end
end
end
def test
ENV['CHECK_SPEC'] = Process.pid.to_s if ENV['TURBO']
Rails::Sequel.connection.disconnect
super
end
def carto_user_dbconsole
u = Carto::User.find_by_username(ARGV[0])
exec "psql -U postgres #{u.database_name}"
end
def carto_resque
ENV['VVERBOSE'] = 'true'
ENV['QUEUE'] = 'imports,exports,users,user_dbs,geocodings,synchronizations,tracker,user_migrations'
ARGV.replace(['resque:work'])
Rake.application.run
end
end
Zeus.plan = CustomPlan.new
Loading…
Cancel
Save