summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-15 09:15:10 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-02-15 09:15:10 +0000
commitd9a8d9f3de2705a3ab568532f3882dd23b3ce27a (patch)
treedd99a05821ae140b9bf2ff917352046acc670154 /spec/migrations
parent6cb5b7c8729151c95d1610f0b2f7255fdac2bdec (diff)
parent02d9f54f197a28f2d102b7346b1212edb7ddc117 (diff)
downloadgitlab-ce-d9a8d9f3de2705a3ab568532f3882dd23b3ce27a.tar.gz
Merge branch 'master' into 'backstage/gb/build-stages-catch-up-migration'
Conflicts: db/schema.rb
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/README.md2
-rw-r--r--spec/migrations/rename_reserved_project_names_spec.rb12
2 files changed, 9 insertions, 5 deletions
diff --git a/spec/migrations/README.md b/spec/migrations/README.md
index 45cf25b96de..49760fa62b8 100644
--- a/spec/migrations/README.md
+++ b/spec/migrations/README.md
@@ -89,5 +89,5 @@ end
## Best practices
1. Note that this type of tests do not run within the transaction, we use
-a truncation database cleanup strategy. Do not depend on transaction being
+a deletion database cleanup strategy. Do not depend on transaction being
present.
diff --git a/spec/migrations/rename_reserved_project_names_spec.rb b/spec/migrations/rename_reserved_project_names_spec.rb
index e6555b1fe6b..34336d705b1 100644
--- a/spec/migrations/rename_reserved_project_names_spec.rb
+++ b/spec/migrations/rename_reserved_project_names_spec.rb
@@ -3,10 +3,14 @@
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20161221153951_rename_reserved_project_names.rb')
-# This migration uses multiple threads, and thus different transactions. This
-# means data created in this spec may not be visible to some threads. To work
-# around this we use the DELETE cleaning strategy.
-describe RenameReservedProjectNames, :delete do
+# This migration is using factories, which set fields that don't actually
+# exist in the DB schema previous to 20161221153951. Thus we just use the
+# latest schema when testing this migration.
+# This is ok-ish because:
+# 1. This migration is a data migration
+# 2. It only relies on very stable DB fields: routes.id, routes.path, namespaces.id, projects.namespace_id
+# Ideally, the test should not use factories and rely on the `table` helper instead.
+describe RenameReservedProjectNames, :migration, schema: :latest do
let(:migration) { described_class.new }
let!(:project) { create(:project) }