forked from e621ng/e621ng
[Tests] Clear elasticsearch before tests run
Previously they were only created if they didn't exist. Data from previous test runs was still present.
This commit is contained in:
parent
499d447352
commit
de4068ade8
@ -18,6 +18,9 @@ FileUtils.chdir APP_ROOT do
|
||||
FileUtils.cp 'docker/danbooru_local_config.rb', 'config/danbooru_local_config.rb'
|
||||
end
|
||||
|
||||
puts "== Creating elasticsearch indices ==\n"
|
||||
system! "RAILS_ENV=development bin/rails runner '[Post, PostVersion].each { |model| model.__elasticsearch__.create_index! }'"
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
# Create the test database, since only development exists at this point
|
||||
system! 'RAILS_ENV=test bin/rails db:create'
|
||||
|
@ -4,12 +4,6 @@ require "digest/md5"
|
||||
require "net/http"
|
||||
require "tempfile"
|
||||
|
||||
puts "== Creating elasticsearch indices ==\n"
|
||||
Post.__elasticsearch__.create_index!
|
||||
PostVersion.__elasticsearch__.create_index!
|
||||
|
||||
puts "== Seeding database with sample content ==\n"
|
||||
|
||||
# Uncomment to see detailed logs
|
||||
# ActiveRecord::Base.logger = ActiveSupport::Logger.new($stdout)
|
||||
|
||||
|
@ -37,6 +37,10 @@ end
|
||||
BCrypt::Engine.send(:remove_const, :DEFAULT_COST)
|
||||
BCrypt::Engine::DEFAULT_COST = BCrypt::Engine::MIN_COST
|
||||
|
||||
# Clear the elastic indicies completly
|
||||
Post.__elasticsearch__.create_index!(force: true)
|
||||
PostVersion.__elasticsearch__.create_index!(force: true)
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
include ActionDispatch::TestProcess::FixtureFile
|
||||
include FactoryBot::Syntax::Methods
|
||||
|
Loading…
Reference in New Issue
Block a user