diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 21:08:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 21:08:08 +0300 |
commit | 83731155d997ae24c7e0cd5ffa6f0dba41bec6dc (patch) | |
tree | 31f785012137fda4ac9a470f4f07c961b42d0299 /spec/migrations | |
parent | 57a37ce99f297cddae12cb4d982b6d572f932bb4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
3 files changed, 0 insertions, 101 deletions
diff --git a/spec/migrations/cleanup_empty_snippet_user_mentions_spec.rb b/spec/migrations/cleanup_empty_snippet_user_mentions_spec.rb deleted file mode 100644 index d229f0b2b59..00000000000 --- a/spec/migrations/cleanup_empty_snippet_user_mentions_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require Rails.root.join('db', 'post_migrate', '20200127111953_cleanup_empty_snippet_user_mentions') - -describe CleanupEmptySnippetUserMentions, :migration, :sidekiq do - let(:users) { table(:users) } - let(:projects) { table(:projects) } - let(:namespaces) { table(:namespaces) } - let(:snippets) { table(:snippets) } - let(:snippet_user_mentions) { table(:snippet_user_mentions) } - let(:notes) { table(:notes) } - - let(:user) { users.create!(name: 'root', email: 'root@example.com', username: 'root', projects_limit: 0) } - let(:group) { namespaces.create!(name: 'group1', path: 'group1', owner_id: user.id) } - let(:project) { projects.create!(name: 'gitlab1', path: 'gitlab1', namespace_id: group.id, visibility_level: 0) } - let(:snippet) { snippets.create!(title: "title1", title_html: 'title1', description: 'snippet description with @root mention', project_id: project.id, author_id: user.id) } - - let!(:resource1) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - let!(:resource2) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet', system: true) } - let!(:resource3) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - - # non-migrateable resources - # this note is already migrated, as it has a record in the snippet_user_mentions table - let!(:resource4) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - let!(:user_mention) { snippet_user_mentions.create!(snippet_id: snippet.id, note_id: resource4.id, mentioned_users_ids: [1]) } - # this note points to an innexistent noteable record - let!(:resource5) { notes.create!(note: 'note for @root to check', noteable_id: snippets.maximum(:id) + 10, noteable_type: 'Snippet') } - - # these should get cleanup, by the migration - let!(:blank_snippet_user_mention1) { snippet_user_mentions.create!(snippet_id: snippet.id, note_id: resource1.id)} - let!(:blank_snippet_user_mention2) { snippet_user_mentions.create!(snippet_id: snippet.id, note_id: resource2.id)} - let!(:blank_snippet_user_mention3) { snippet_user_mentions.create!(snippet_id: snippet.id, note_id: resource3.id)} - - it 'cleanups blank user mentions' do - expect(snippet_user_mentions.count).to eq 4 - - migrate! - - expect(snippet_user_mentions.count).to eq 1 - end -end diff --git a/spec/migrations/migrate_snippet_mentions_to_db_spec.rb b/spec/migrations/migrate_snippet_mentions_to_db_spec.rb deleted file mode 100644 index 6644329fc11..00000000000 --- a/spec/migrations/migrate_snippet_mentions_to_db_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require Rails.root.join('db', 'post_migrate', '20200127131953_migrate_snippet_mentions_to_db') - -describe MigrateSnippetMentionsToDb, :migration, :sidekiq do - let(:users) { table(:users) } - let(:namespaces) { table(:namespaces) } - let(:projects) { table(:projects) } - let(:snippets) { table(:snippets) } - let(:snippet_user_mentions) { table(:snippet_user_mentions) } - - let(:user) { users.create!(name: 'root', email: 'root@example.com', username: 'root', projects_limit: 0) } - let(:group) { namespaces.create!(name: 'group1', path: 'group1', owner_id: user.id) } - let(:project) { projects.create!(name: 'gitlab1', path: 'gitlab1', namespace_id: group.id, visibility_level: 0) } - let!(:resource1) { snippets.create!(title: "title1", title_html: 'title1', description: 'snippet description with @root mention', project_id: project.id, author_id: user.id) } - let!(:resource2) { snippets.create!(title: "title2", title_html: "title2", description: 'snippet description with @group mention', project_id: project.id, author_id: user.id) } - let!(:resource3) { snippets.create!(title: "title3", title_html: "title3", description: 'snippet description with @project mention', project_id: project.id, author_id: user.id) } - - # non-migrateable resources - # this snippet is already migrated, as it has a record in the snippet_user_mentions table - let!(:resource4) { snippets.create!(title: "title4", title_html: "title4", description: 'snippet description with @project mention', project_id: project.id, author_id: user.id) } - let!(:user_mention) { snippet_user_mentions.create!(snippet_id: resource4.id, mentioned_users_ids: [1]) } - # this snippet has no mentions so should be filtered out - let!(:resource5) { snippets.create!(title: "title5", title_html: "title5", description: 'snippet description with no mention', project_id: project.id, author_id: user.id) } - - it_behaves_like 'schedules resource mentions migration', Snippet, false -end diff --git a/spec/migrations/migrate_snippet_notes_mentions_to_db_spec.rb b/spec/migrations/migrate_snippet_notes_mentions_to_db_spec.rb deleted file mode 100644 index 2ebe80e6ae3..00000000000 --- a/spec/migrations/migrate_snippet_notes_mentions_to_db_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require Rails.root.join('db', 'post_migrate', '20200127151953_migrate_snippet_notes_mentions_to_db') - -describe MigrateSnippetNotesMentionsToDb, :migration, :sidekiq do - let(:users) { table(:users) } - let(:projects) { table(:projects) } - let(:namespaces) { table(:namespaces) } - let(:snippets) { table(:snippets) } - let(:snippet_user_mentions) { table(:snippet_user_mentions) } - let(:notes) { table(:notes) } - - let(:user) { users.create!(name: 'root', email: 'root@example.com', username: 'root', projects_limit: 0) } - let(:group) { namespaces.create!(name: 'group1', path: 'group1', owner_id: user.id) } - let(:project) { projects.create!(name: 'gitlab1', path: 'gitlab1', namespace_id: group.id, visibility_level: 0) } - let(:snippet) { snippets.create!(title: "title1", title_html: 'title1', description: 'snippet description with @root mention', project_id: project.id, author_id: user.id) } - - let!(:resource1) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - let!(:resource2) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet', system: true) } - let!(:resource3) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - - # non-migrateable resources - # this note is already migrated, as it has a record in the snippet_user_mentions table - let!(:resource4) { notes.create!(note: 'note for @root to check', noteable_id: snippet.id, noteable_type: 'Snippet') } - let!(:user_mention) { snippet_user_mentions.create!(snippet_id: snippet.id, note_id: resource4.id, mentioned_users_ids: [1]) } - # this note points to an innexistent noteable record - let!(:resource5) { notes.create!(note: 'note for @root to check', noteable_id: snippets.maximum(:id) + 10, noteable_type: 'Snippet') } - - it_behaves_like 'schedules resource mentions migration', Snippet, true -end |