Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use different db for specs and legacy specs on CI

Christophe Bliard305a3f7c3007
diff --git a/docker/ci/entrypoint.sh b/docker/ci/entrypoint.sh
index 0b9e1d5ceaf..a225fcc7b73 100755
--- a/docker/ci/entrypoint.sh
+++ b/docker/ci/entrypoint.sh
@@ -5,6 +5,7 @@ export PGBIN="/usr/lib/postgresql/$PGVERSION/bin"
export JOBS="${CI_JOBS:=$(nproc)}"
# for parallel rspec
export PARALLEL_TEST_PROCESSORS=$JOBS
+export PARALLEL_TEST_FIRST_IS_1=true
# if from within docker
if [ $(id -u) -eq 0 ]; then
@@ -32,7 +33,7 @@ execute() {
}
cleanup() {
- rm -rf tmp/cache/parallel*
+ rm -rf tmp/cache/parallel*
}
if [ "$1" == "setup-tests" ]; then
@@ -51,7 +52,9 @@ if [ "$1" == "setup-tests" ]; then
done
execute "time bundle install -j$JOBS"
- execute "TEST_ENV_NUMBER=0 time bundle exec rake db:create db:migrate db:schema:dump webdrivers:chromedriver:update webdrivers:geckodriver:update openproject:plugins:register_frontend"
+ # create test database "app" and dump schema
+ execute "time bundle exec rake db:create db:migrate db:schema:dump webdrivers:chromedriver:update webdrivers:geckodriver:update openproject:plugins:register_frontend"
+ # create parallel test databases "app#n" and load schema
execute "time bundle exec rake parallel:create parallel:load_schema"
fi
diff --git a/spec_legacy/legacy_spec_helper.rb b/spec_legacy/legacy_spec_helper.rb
index 6eb00033bf5..1cbf0a49c01 100644
--- a/spec_legacy/legacy_spec_helper.rb
+++ b/spec_legacy/legacy_spec_helper.rb
@@ -55,6 +55,11 @@ RSpec.configure do |config|
DatabaseCleaner.clean_with(:truncation)
end
+ # Clear fixtures so that normal specs can run without needing truncation
+ config.after(:suite) do
+ DatabaseCleaner.clean_with(:truncation)
+ end
+
config.include LegacyAssertionsAndHelpers
config.include ActiveSupport::Testing::Assertions
config.include Shoulda::Context::Assertions