Commit 83dcf9a4 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 3b261c3e e3426d08
- object = @target_project || @project || @group - object = @target_project || @project || @group
- noteable_type = @noteable.class if @noteable.present? - noteable_type = @noteable_type || @noteable&.class
- datasources = autocomplete_data_sources(object, noteable_type) - datasources = autocomplete_data_sources(object, noteable_type)
......
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
iterations: [], iterations: [],
loading: false, loading: false,
title: this.iteration.title, title: this.iteration.title,
description: this.iteration.description, description: this.iteration.description ?? '',
startDate: this.iteration.startDate, startDate: this.iteration.startDate,
dueDate: this.iteration.dueDate, dueDate: this.iteration.dueDate,
}; };
......
...@@ -4,6 +4,7 @@ class Groups::IterationsController < Groups::ApplicationController ...@@ -4,6 +4,7 @@ class Groups::IterationsController < Groups::ApplicationController
before_action :check_iterations_available! before_action :check_iterations_available!
before_action :authorize_show_iteration!, only: [:index, :show] before_action :authorize_show_iteration!, only: [:index, :show]
before_action :authorize_create_iteration!, only: [:new, :edit] before_action :authorize_create_iteration!, only: [:new, :edit]
before_action :set_noteable_type, only: [:show, :new, :edit]
feature_category :team_planning feature_category :team_planning
...@@ -17,6 +18,10 @@ class Groups::IterationsController < Groups::ApplicationController ...@@ -17,6 +18,10 @@ class Groups::IterationsController < Groups::ApplicationController
private private
def set_noteable_type
@noteable_type = Iteration
end
def check_iterations_available! def check_iterations_available!
render_404 unless group.licensed_feature_available?(:iterations) render_404 unless group.licensed_feature_available?(:iterations)
end end
......
- @gfm_form = true
- add_to_breadcrumbs _("Iterations"), group_iterations_path(@group) - add_to_breadcrumbs _("Iterations"), group_iterations_path(@group)
- breadcrumb_title params[:id] - breadcrumb_title params[:id]
- page_title s_("Iterations|Edit iteration") - page_title s_("Iterations|Edit iteration")
......
- @gfm_form = true
- add_to_breadcrumbs _("Iterations"), group_iterations_path(@group) - add_to_breadcrumbs _("Iterations"), group_iterations_path(@group)
- breadcrumb_title _("New") - breadcrumb_title _("New")
- page_title _("Iterations") - page_title _("Iterations")
......
- @gfm_form = true
- add_to_breadcrumbs _("Iterations"), group_iterations_path(@group) - add_to_breadcrumbs _("Iterations"), group_iterations_path(@group)
- breadcrumb_title params[:id] - breadcrumb_title params[:id]
- page_title _("Iterations") - page_title _("Iterations")
......
...@@ -59,7 +59,7 @@ RSpec.describe 'Group value stream analytics filters and data', :js do ...@@ -59,7 +59,7 @@ RSpec.describe 'Group value stream analytics filters and data', :js do
shared_examples 'empty state' do shared_examples 'empty state' do
it 'displays an empty state' do it 'displays an empty state' do
element = page.find('.row.empty-state') element = page.find('.empty-state')
expect(element).to have_content(_("We don't have enough data to show this stage.")) expect(element).to have_content(_("We don't have enough data to show this stage."))
expect(element.find('.svg-content img')['src']).to have_content('illustrations/analytics/cycle-analytics-empty-chart') expect(element.find('.svg-content img')['src']).to have_content('illustrations/analytics/cycle-analytics-empty-chart')
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
exports[`EmptyState renders properly 1`] = ` exports[`EmptyState renders properly 1`] = `
<section <section
class="row empty-state text-center" class="gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column"
> >
<div <div
class="col-12" class="gl-max-w-full"
> >
<div <div
class="svg-250 svg-content" class="svg-250 svg-content"
...@@ -20,10 +20,10 @@ exports[`EmptyState renders properly 1`] = ` ...@@ -20,10 +20,10 @@ exports[`EmptyState renders properly 1`] = `
</div> </div>
<div <div
class="col-12" class="gl-max-w-full gl-m-auto"
> >
<div <div
class="text-content gl-mx-auto gl-my-0 gl-p-5" class="gl-mx-auto gl-my-0 gl-p-5"
> >
<h1 <h1
class="gl-font-size-h-display gl-line-height-36 h4" class="gl-font-size-h-display gl-line-height-36 h4"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`dashboard has no vulnerabilities empty state matches snapshot 1`] = ` exports[`dashboard has no vulnerabilities empty state matches snapshot 1`] = `
"<section class=\\"row gl-mt-0 empty-state text-center\\"> "<section class=\\"gl-display-flex gl-flex-wrap gl-mt-0 empty-state gl-text-center gl-flex-direction-column\\">
<div class=\\"col-12\\"> <div class=\\"gl-max-w-full\\">
<div class=\\"svg-250 svg-content\\"><img src=\\"/placeholder.svg\\" alt=\\"\\" role=\\"img\\" class=\\"gl-max-w-full\\"></div> <div class=\\"svg-250 svg-content\\"><img src=\\"/placeholder.svg\\" alt=\\"\\" role=\\"img\\" class=\\"gl-max-w-full\\"></div>
</div> </div>
<div class=\\"col-12\\"> <div class=\\"gl-max-w-full gl-m-auto\\">
<div class=\\"text-content gl-mx-auto gl-my-0 gl-p-5\\"> <div class=\\"gl-mx-auto gl-my-0 gl-p-5\\">
<h1 class=\\"gl-font-size-h-display gl-line-height-36 h4\\"> <h1 class=\\"gl-font-size-h-display gl-line-height-36 h4\\">
No vulnerabilities found No vulnerabilities found
</h1> </h1>
......
...@@ -33,10 +33,10 @@ exports[`Security Dashboard default states sets up instance-level 1`] = ` ...@@ -33,10 +33,10 @@ exports[`Security Dashboard default states sets up instance-level 1`] = `
exports[`Security Dashboard error states has unavailable pages 1`] = ` exports[`Security Dashboard error states has unavailable pages 1`] = `
<div> <div>
<section <section
class="row empty-state text-center" class="gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column"
> >
<div <div
class="col-12" class="gl-max-w-full"
> >
<div <div
class="svg-250 svg-content" class="svg-250 svg-content"
...@@ -50,10 +50,10 @@ exports[`Security Dashboard error states has unavailable pages 1`] = ` ...@@ -50,10 +50,10 @@ exports[`Security Dashboard error states has unavailable pages 1`] = `
</div> </div>
</div> </div>
<div <div
class="col-12" class="gl-max-w-full gl-m-auto"
> >
<div <div
class="text-content gl-mx-auto gl-my-0 gl-p-5" class="gl-mx-auto gl-my-0 gl-p-5"
> >
<h1 <h1
class="gl-font-size-h-display gl-line-height-36 h4" class="gl-font-size-h-display gl-line-height-36 h4"
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
exports[`Vulnerability Report error states has unavailable pages 1`] = ` exports[`Vulnerability Report error states has unavailable pages 1`] = `
<div> <div>
<section <section
class="row empty-state text-center" class="gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column"
> >
<div <div
class="col-12" class="gl-max-w-full"
> >
<div <div
class="svg-250 svg-content" class="svg-250 svg-content"
...@@ -20,10 +20,10 @@ exports[`Vulnerability Report error states has unavailable pages 1`] = ` ...@@ -20,10 +20,10 @@ exports[`Vulnerability Report error states has unavailable pages 1`] = `
</div> </div>
</div> </div>
<div <div
class="col-12" class="gl-max-w-full gl-m-auto"
> >
<div <div
class="text-content gl-mx-auto gl-my-0 gl-p-5" class="gl-mx-auto gl-my-0 gl-p-5"
> >
<h1 <h1
class="gl-font-size-h-display gl-line-height-36 h4" class="gl-font-size-h-display gl-line-height-36 h4"
......
...@@ -32,14 +32,14 @@ RSpec.describe Integration do ...@@ -32,14 +32,14 @@ RSpec.describe Integration do
end end
describe '.vulnerability_hooks' do describe '.vulnerability_hooks' do
it 'includes services where vulnerability_events is true' do it 'includes integrations where vulnerability_events is true' do
create(:service, active: true, vulnerability_events: true) create(:integration, active: true, vulnerability_events: true)
expect(described_class.vulnerability_hooks.count).to eq 1 expect(described_class.vulnerability_hooks.count).to eq 1
end end
it 'excludes services where vulnerability_events is false' do it 'excludes integrations where vulnerability_events is false' do
create(:service, active: true, vulnerability_events: false) create(:integration, active: true, vulnerability_events: false)
expect(described_class.vulnerability_hooks.count).to eq 0 expect(described_class.vulnerability_hooks.count).to eq 0
end end
......
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
# Background migration for cleaning up a concurrent column rename.
class CleanupConcurrentRename < CleanupConcurrentSchemaChange
RESCHEDULE_DELAY = 10.minutes
def cleanup_concurrent_schema_change(table, old_column, new_column)
cleanup_concurrent_column_rename(table, old_column, new_column)
end
end
end
end
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
# Base class for background migration for rename/type changes.
class CleanupConcurrentSchemaChange
include Database::MigrationHelpers
# table - The name of the table the migration is performed for.
# old_column - The name of the old (to drop) column.
# new_column - The name of the new column.
def perform(table, old_column, new_column)
return unless column_exists?(table, new_column) && column_exists?(table, old_column)
rows_to_migrate = define_model_for(table)
.where(new_column => nil)
.where
.not(old_column => nil)
if rows_to_migrate.any?
BackgroundMigrationWorker.perform_in(
RESCHEDULE_DELAY,
self.class.name,
[table, old_column, new_column]
)
else
cleanup_concurrent_schema_change(table, old_column, new_column)
end
end
def cleanup_concurrent_schema_change(_table, _old_column, _new_column)
raise NotImplementedError
end
# These methods are necessary so we can re-use the migration helpers in
# this class.
def connection
ActiveRecord::Base.connection
end
def method_missing(name, *args, &block)
connection.__send__(name, *args, &block) # rubocop: disable GitlabSecurity/PublicSend
end
def respond_to_missing?(*args)
connection.respond_to?(*args) || super
end
def define_model_for(table)
Class.new(ActiveRecord::Base) do
self.table_name = table
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
# Background migration for cleaning up a concurrent column type changeb.
class CleanupConcurrentTypeChange < CleanupConcurrentSchemaChange
RESCHEDULE_DELAY = 10.minutes
def cleanup_concurrent_schema_change(table, old_column, new_column)
cleanup_concurrent_column_type_change(table, old_column)
end
end
end
end
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
# CopyColumn is a simple (reusable) background migration that can be used to
# update the value of a column based on the value of another column in the
# same table.
#
# For this background migration to work the table that is migrated _has_ to
# have an `id` column as the primary key.
class CopyColumn
# table - The name of the table that contains the columns.
# copy_from - The column containing the data to copy.
# copy_to - The column to copy the data to.
# start_id - The start ID of the range of rows to update.
# end_id - The end ID of the range of rows to update.
def perform(table, copy_from, copy_to, start_id, end_id)
return unless connection.column_exists?(table, copy_to)
quoted_table = connection.quote_table_name(table)
quoted_copy_from = connection.quote_column_name(copy_from)
quoted_copy_to = connection.quote_column_name(copy_to)
# We're using raw SQL here since this job may be frequently executed. As
# a result dynamically defining models would lead to many unnecessary
# schema information queries.
connection.execute <<-SQL.strip_heredoc
UPDATE #{quoted_table}
SET #{quoted_copy_to} = #{quoted_copy_from}
WHERE id BETWEEN #{start_id} AND #{end_id}
AND #{quoted_copy_from} IS NOT NULL
AND #{quoted_copy_to} IS NULL
SQL
end
def connection
ActiveRecord::Base.connection
end
end
end
end
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :integration, aliases: [:service] do factory :integration do
project project
type { 'Integration' } type { 'Integration' }
end end
......
...@@ -19,16 +19,16 @@ FactoryBot.define do ...@@ -19,16 +19,16 @@ FactoryBot.define do
create(:jira_import_state, :finished, project: projects[1], label: jira_label, imported_issues_count: 3) create(:jira_import_state, :finished, project: projects[1], label: jira_label, imported_issues_count: 3)
create(:jira_import_state, :scheduled, project: projects[1], label: jira_label) create(:jira_import_state, :scheduled, project: projects[1], label: jira_label)
create(:prometheus_integration, project: projects[1]) create(:prometheus_integration, project: projects[1])
create(:service, project: projects[1], type: 'JenkinsService', active: true) create(:integration, project: projects[1], type: 'JenkinsService', active: true)
create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true) create(:integration, project: projects[0], type: 'SlackSlashCommandsService', active: true)
create(:service, project: projects[1], type: 'SlackService', active: true) create(:integration, project: projects[1], type: 'SlackService', active: true)
create(:service, project: projects[2], type: 'SlackService', active: true) create(:integration, project: projects[2], type: 'SlackService', active: true)
create(:service, project: projects[2], type: 'MattermostService', active: false) create(:integration, project: projects[2], type: 'MattermostService', active: false)
create(:service, group: group, project: nil, type: 'MattermostService', active: true) create(:integration, group: group, project: nil, type: 'MattermostService', active: true)
mattermost_instance = create(:service, :instance, type: 'MattermostService', active: true) mattermost_instance = create(:integration, :instance, type: 'MattermostService', active: true)
create(:service, project: projects[1], type: 'MattermostService', active: true, inherit_from_id: mattermost_instance.id) create(:integration, project: projects[1], type: 'MattermostService', active: true, inherit_from_id: mattermost_instance.id)
create(:service, group: group, project: nil, type: 'SlackService', active: true, inherit_from_id: mattermost_instance.id) create(:integration, group: group, project: nil, type: 'SlackService', active: true, inherit_from_id: mattermost_instance.id)
create(:service, project: projects[2], type: 'CustomIssueTrackerService', active: true) create(:integration, project: projects[2], type: 'CustomIssueTrackerService', active: true)
create(:project_error_tracking_setting, project: projects[0]) create(:project_error_tracking_setting, project: projects[0])
create(:project_error_tracking_setting, project: projects[1], enabled: false) create(:project_error_tracking_setting, project: projects[1], enabled: false)
alert_bot_issues = create_list(:incident, 2, project: projects[0], author: User.alert_bot) alert_bot_issues = create_list(:incident, 2, project: projects[0], author: User.alert_bot)
......
...@@ -96,7 +96,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do ...@@ -96,7 +96,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do
context 'view merge request with external CI service' do context 'view merge request with external CI service' do
before do before do
create(:service, project: project, create(:integration, project: project,
active: true, active: true,
type: 'DroneCiService', type: 'DroneCiService',
category: 'ci') category: 'ci')
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Profile > Chat' do RSpec.describe 'Profile > Chat' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:integration) { create(:service) } let(:integration) { create(:integration) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -10,10 +10,10 @@ exports[`packages_list_app renders 1`] = ` ...@@ -10,10 +10,10 @@ exports[`packages_list_app renders 1`] = `
<div> <div>
<section <section
class="row empty-state text-center" class="gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column"
> >
<div <div
class="col-12" class="gl-max-w-full"
> >
<div <div
class="svg-250 svg-content" class="svg-250 svg-content"
...@@ -28,10 +28,10 @@ exports[`packages_list_app renders 1`] = ` ...@@ -28,10 +28,10 @@ exports[`packages_list_app renders 1`] = `
</div> </div>
<div <div
class="col-12" class="gl-max-w-full gl-m-auto"
> >
<div <div
class="text-content gl-mx-auto gl-my-0 gl-p-5" class="gl-mx-auto gl-my-0 gl-p-5"
> >
<h1 <h1
class="gl-font-size-h-display gl-line-height-36 h4" class="gl-font-size-h-display gl-line-height-36 h4"
......
...@@ -11,10 +11,10 @@ exports[`PackagesListApp renders 1`] = ` ...@@ -11,10 +11,10 @@ exports[`PackagesListApp renders 1`] = `
<div> <div>
<section <section
class="row empty-state text-center" class="gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column"
> >
<div <div
class="col-12" class="gl-max-w-full"
> >
<div <div
class="svg-250 svg-content" class="svg-250 svg-content"
...@@ -29,10 +29,10 @@ exports[`PackagesListApp renders 1`] = ` ...@@ -29,10 +29,10 @@ exports[`PackagesListApp renders 1`] = `
</div> </div>
<div <div
class="col-12" class="gl-max-w-full gl-m-auto"
> >
<div <div
class="text-content gl-mx-auto gl-my-0 gl-p-5" class="gl-mx-auto gl-my-0 gl-p-5"
> >
<h1 <h1
class="gl-font-size-h-display gl-line-height-36 h4" class="gl-font-size-h-display gl-line-height-36 h4"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EmptyStateComponent should render content 1`] = ` exports[`EmptyStateComponent should render content 1`] = `
"<section class=\\"row empty-state text-center\\"> "<section class=\\"gl-display-flex gl-flex-wrap empty-state gl-text-center gl-flex-direction-column\\">
<div class=\\"col-12\\"> <div class=\\"gl-max-w-full\\">
<div class=\\"svg-250 svg-content\\"><img src=\\"/image.svg\\" alt=\\"\\" role=\\"img\\" class=\\"gl-max-w-full\\"></div> <div class=\\"svg-250 svg-content\\"><img src=\\"/image.svg\\" alt=\\"\\" role=\\"img\\" class=\\"gl-max-w-full\\"></div>
</div> </div>
<div class=\\"col-12\\"> <div class=\\"gl-max-w-full gl-m-auto\\">
<div class=\\"text-content gl-mx-auto gl-my-0 gl-p-5\\"> <div class=\\"gl-mx-auto gl-my-0 gl-p-5\\">
<h1 class=\\"gl-font-size-h-display gl-line-height-36 h4\\"> <h1 class=\\"gl-font-size-h-display gl-line-height-36 h4\\">
Getting started with serverless Getting started with serverless
</h1> </h1>
......
...@@ -8,7 +8,7 @@ RSpec.describe Types::Projects::ServiceType do ...@@ -8,7 +8,7 @@ RSpec.describe Types::Projects::ServiceType do
describe ".resolve_type" do describe ".resolve_type" do
it 'resolves the corresponding type for objects' do it 'resolves the corresponding type for objects' do
expect(described_class.resolve_type(build(:jira_integration), {})).to eq(Types::Projects::Services::JiraServiceType) expect(described_class.resolve_type(build(:jira_integration), {})).to eq(Types::Projects::Services::JiraServiceType)
expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:integration), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:drone_ci_integration), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:drone_ci_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
expect(described_class.resolve_type(build(:custom_issue_tracker_integration), {})).to eq(Types::Projects::Services::BaseServiceType) expect(described_class.resolve_type(build(:custom_issue_tracker_integration), {})).to eq(Types::Projects::Services::BaseServiceType)
end end
......
...@@ -86,7 +86,7 @@ RSpec.describe AutoDevopsHelper do ...@@ -86,7 +86,7 @@ RSpec.describe AutoDevopsHelper do
context 'when another service is enabled' do context 'when another service is enabled' do
before do before do
create(:service, project: project, category: :ci, active: true) create(:integration, project: project, category: :ci, active: true)
end end
it { is_expected.to eq(false) } it { is_expected.to eq(false) }
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::BackgroundMigration::CleanupConcurrentSchemaChange do
describe '#perform' do
it 'new column does not exist' do
expect(subject).to receive(:column_exists?).with(:issues, :closed_at_timestamp).and_return(false)
expect(subject).not_to receive(:column_exists?).with(:issues, :closed_at)
expect(subject).not_to receive(:define_model_for)
expect(subject.perform(:issues, :closed_at, :closed_at_timestamp)).to be_nil
end
it 'old column does not exist' do
expect(subject).to receive(:column_exists?).with(:issues, :closed_at_timestamp).and_return(true)
expect(subject).to receive(:column_exists?).with(:issues, :closed_at).and_return(false)
expect(subject).not_to receive(:define_model_for)
expect(subject.perform(:issues, :closed_at, :closed_at_timestamp)).to be_nil
end
it 'has both old and new columns' do
expect(subject).to receive(:column_exists?).twice.and_return(true)
expect { subject.perform('issues', :closed_at, :created_at) }.to raise_error(NotImplementedError)
end
end
end
...@@ -258,7 +258,7 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do ...@@ -258,7 +258,7 @@ RSpec.describe Gitlab::ImportExport::FastHashSerializer do
create(:resource_label_event, label: group_label, merge_request: merge_request) create(:resource_label_event, label: group_label, merge_request: merge_request)
create(:event, :created, target: milestone, project: project, author: user) create(:event, :created, target: milestone, project: project, author: user)
create(:service, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker', properties: { one: 'value' }) create(:integration, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker', properties: { one: 'value' })
create(:project_custom_attribute, project: project) create(:project_custom_attribute, project: project)
create(:project_custom_attribute, project: project) create(:project_custom_attribute, project: project)
......
...@@ -88,7 +88,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_ ...@@ -88,7 +88,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
end end
context 'original service exists' do context 'original service exists' do
let(:service_id) { create(:service, project: project).id } let(:service_id) { create(:integration, project: project).id }
it 'does not have the original service_id' do it 'does not have the original service_id' do
expect(created_object.service_id).not_to eq(service_id) expect(created_object.service_id).not_to eq(service_id)
......
...@@ -46,11 +46,11 @@ RSpec.describe Gitlab::Integrations::StiType do ...@@ -46,11 +46,11 @@ RSpec.describe Gitlab::Integrations::StiType do
SQL SQL
end end
let_it_be(:service) { create(:service) } let_it_be(:integration) { create(:integration) }
it 'forms SQL UPDATE statements correctly' do it 'forms SQL UPDATE statements correctly' do
sql_statements = types.map do |type| sql_statements = types.map do |type|
record = ActiveRecord::QueryRecorder.new { service.update_column(:type, type) } record = ActiveRecord::QueryRecorder.new { integration.update_column(:type, type) }
record.log.first record.log.first
end end
...@@ -65,8 +65,6 @@ RSpec.describe Gitlab::Integrations::StiType do ...@@ -65,8 +65,6 @@ RSpec.describe Gitlab::Integrations::StiType do
SQL SQL
end end
let(:service) { create(:service) }
it 'forms SQL DELETE statements correctly' do it 'forms SQL DELETE statements correctly' do
sql_statements = types.map do |type| sql_statements = types.map do |type|
record = ActiveRecord::QueryRecorder.new { Integration.delete_by(type: type) } record = ActiveRecord::QueryRecorder.new { Integration.delete_by(type: type) }
...@@ -81,7 +79,7 @@ RSpec.describe Gitlab::Integrations::StiType do ...@@ -81,7 +79,7 @@ RSpec.describe Gitlab::Integrations::StiType do
describe '#deserialize' do describe '#deserialize' do
specify 'it deserializes type correctly', :aggregate_failures do specify 'it deserializes type correctly', :aggregate_failures do
types.each do |type| types.each do |type|
service = create(:service, type: type) service = create(:integration, type: type)
expect(service.type).to eq('AsanaService') expect(service.type).to eq('AsanaService')
end end
...@@ -90,7 +88,7 @@ RSpec.describe Gitlab::Integrations::StiType do ...@@ -90,7 +88,7 @@ RSpec.describe Gitlab::Integrations::StiType do
describe '#cast' do describe '#cast' do
it 'casts type as model correctly', :aggregate_failures do it 'casts type as model correctly', :aggregate_failures do
create(:service, type: 'AsanaService') create(:integration, type: 'AsanaService')
types.each do |type| types.each do |type|
expect(Integration.find_by(type: type)).to be_kind_of(Integrations::Asana) expect(Integration.find_by(type: type)).to be_kind_of(Integrations::Asana)
...@@ -100,7 +98,7 @@ RSpec.describe Gitlab::Integrations::StiType do ...@@ -100,7 +98,7 @@ RSpec.describe Gitlab::Integrations::StiType do
describe '#changed?' do describe '#changed?' do
it 'detects changes correctly', :aggregate_failures do it 'detects changes correctly', :aggregate_failures do
service = create(:service, type: 'AsanaService') service = create(:integration, type: 'AsanaService')
types.each do |type| types.each do |type|
service.type = type service.type = type
......
This diff is collapsed.
...@@ -1359,51 +1359,51 @@ RSpec.describe Project, factory_default: :keep do ...@@ -1359,51 +1359,51 @@ RSpec.describe Project, factory_default: :keep do
project.reload.has_external_issue_tracker project.reload.has_external_issue_tracker
end end
it 'is false when external issue tracker service is not active' do it 'is false when external issue tracker integration is not active' do
create(:service, project: project, category: 'issue_tracker', active: false) create(:integration, project: project, category: 'issue_tracker', active: false)
is_expected.to eq(false) is_expected.to eq(false)
end end
it 'is false when other service is active' do it 'is false when other integration is active' do
create(:service, project: project, category: 'not_issue_tracker', active: true) create(:integration, project: project, category: 'not_issue_tracker', active: true)
is_expected.to eq(false) is_expected.to eq(false)
end end
context 'when there is an active external issue tracker service' do context 'when there is an active external issue tracker integration' do
let!(:service) do let!(:integration) do
create(:service, project: project, type: 'JiraService', category: 'issue_tracker', active: true) create(:integration, project: project, type: 'JiraService', category: 'issue_tracker', active: true)
end end
specify { is_expected.to eq(true) } specify { is_expected.to eq(true) }
it 'becomes false when external issue tracker service is destroyed' do it 'becomes false when external issue tracker integration is destroyed' do
expect do expect do
Integration.find(service.id).delete Integration.find(integration.id).delete
end.to change { subject }.to(false) end.to change { subject }.to(false)
end end
it 'becomes false when external issue tracker service becomes inactive' do it 'becomes false when external issue tracker integration becomes inactive' do
expect do expect do
service.update_column(:active, false) integration.update_column(:active, false)
end.to change { subject }.to(false) end.to change { subject }.to(false)
end end
context 'when there are two active external issue tracker services' do context 'when there are two active external issue tracker integrations' do
let_it_be(:second_service) do let_it_be(:second_integration) do
create(:service, project: project, type: 'CustomIssueTracker', category: 'issue_tracker', active: true) create(:integration, project: project, type: 'CustomIssueTracker', category: 'issue_tracker', active: true)
end end
it 'does not become false when external issue tracker service is destroyed' do it 'does not become false when external issue tracker integration is destroyed' do
expect do expect do
Integration.find(service.id).delete Integration.find(integration.id).delete
end.not_to change { subject } end.not_to change { subject }
end end
it 'does not become false when external issue tracker service becomes inactive' do it 'does not become false when external issue tracker integration becomes inactive' do
expect do expect do
service.update_column(:active, false) integration.update_column(:active, false)
end.not_to change { subject } end.not_to change { subject }
end end
end end
...@@ -1455,13 +1455,13 @@ RSpec.describe Project, factory_default: :keep do ...@@ -1455,13 +1455,13 @@ RSpec.describe Project, factory_default: :keep do
specify { expect(has_external_wiki).to eq(true) } specify { expect(has_external_wiki).to eq(true) }
it 'becomes false if the external wiki service is destroyed' do it 'becomes false if the external wiki integration is destroyed' do
expect do expect do
Integration.find(integration.id).delete Integration.find(integration.id).delete
end.to change { has_external_wiki }.to(false) end.to change { has_external_wiki }.to(false)
end end
it 'becomes false if the external wiki service becomes inactive' do it 'becomes false if the external wiki integration becomes inactive' do
expect do expect do
integration.update_column(:active, false) integration.update_column(:active, false)
end.to change { has_external_wiki }.to(false) end.to change { has_external_wiki }.to(false)
...@@ -6836,7 +6836,7 @@ RSpec.describe Project, factory_default: :keep do ...@@ -6836,7 +6836,7 @@ RSpec.describe Project, factory_default: :keep do
describe 'with integrations and chat names' do describe 'with integrations and chat names' do
subject { create(:project) } subject { create(:project) }
let(:integration) { create(:service, project: subject) } let(:integration) { create(:integration, project: subject) }
before do before do
create_list(:chat_name, 5, integration: integration) create_list(:chat_name, 5, integration: integration)
......
...@@ -4,10 +4,10 @@ require 'spec_helper' ...@@ -4,10 +4,10 @@ require 'spec_helper'
RSpec.describe ChatNames::AuthorizeUserService do RSpec.describe ChatNames::AuthorizeUserService do
describe '#execute' do describe '#execute' do
subject { described_class.new(service, params) } let(:integration) { create(:integration) }
let(:result) { subject.execute } let(:result) { subject.execute }
let(:service) { create(:service) }
subject { described_class.new(integration, params) }
context 'when all parameters are valid' do context 'when all parameters are valid' do
let(:params) { { team_id: 'T0001', team_domain: 'myteam', user_id: 'U0001', user_name: 'user' } } let(:params) { { team_id: 'T0001', team_domain: 'myteam', user_id: 'U0001', user_name: 'user' } }
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe ChatNames::FindUserService, :clean_gitlab_redis_shared_state do RSpec.describe ChatNames::FindUserService, :clean_gitlab_redis_shared_state do
describe '#execute' do describe '#execute' do
let(:integration) { create(:service) } let(:integration) { create(:integration) }
subject { described_class.new(integration, params).execute } subject { described_class.new(integration, params).execute }
......
...@@ -44,7 +44,7 @@ module ExportFileHelper ...@@ -44,7 +44,7 @@ module ExportFileHelper
create(:ci_trigger, project: project) create(:ci_trigger, project: project)
key = create(:deploy_key) key = create(:deploy_key)
key.projects << project key.projects << project
create(:service, project: project) create(:integration, project: project)
create(:project_hook, project: project, token: 'token') create(:project_hook, project: project, token: 'token')
create(:protected_branch, project: project) create(:protected_branch, project: project)
......
...@@ -13,7 +13,7 @@ RSpec.describe Deployments::HooksWorker do ...@@ -13,7 +13,7 @@ RSpec.describe Deployments::HooksWorker do
it 'executes project services for deployment_hooks' do it 'executes project services for deployment_hooks' do
deployment = create(:deployment, :running) deployment = create(:deployment, :running)
project = deployment.project project = deployment.project
service = create(:service, type: 'SlackService', project: project, deployment_events: true, active: true) service = create(:integration, type: 'SlackService', project: project, deployment_events: true, active: true)
expect(ProjectServiceWorker).to receive(:perform_async).with(service.id, an_instance_of(Hash)) expect(ProjectServiceWorker).to receive(:perform_async).with(service.id, an_instance_of(Hash))
...@@ -23,7 +23,7 @@ RSpec.describe Deployments::HooksWorker do ...@@ -23,7 +23,7 @@ RSpec.describe Deployments::HooksWorker do
it 'does not execute an inactive service' do it 'does not execute an inactive service' do
deployment = create(:deployment, :running) deployment = create(:deployment, :running)
project = deployment.project project = deployment.project
create(:service, type: 'SlackService', project: project, deployment_events: true, active: false) create(:integration, type: 'SlackService', project: project, deployment_events: true, active: false)
expect(ProjectServiceWorker).not_to receive(:perform_async) expect(ProjectServiceWorker).not_to receive(:perform_async)
......
...@@ -924,10 +924,10 @@ ...@@ -924,10 +924,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8" resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw== integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
"@gitlab/ui@32.50.0": "@gitlab/ui@32.51.3":
version "32.50.0" version "32.51.3"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.50.0.tgz#ac50617a8b84f78949e177f495ade276f8560679" resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.51.3.tgz#1ba4802a16ecf5465774f4083e5ec1ed6adc4579"
integrity sha512-7wPEgbOn7M9hqzq5LZND5b8/OEajoFCjwaXzO42FBNJ+pb80JBsTg1Mu8dyXMGQP/SPcxO58BdQLUSjE0WER4w== integrity sha512-PWC0FtpsW9SM3O935XPU2el/JtLtvHQCL9qblKCeR98eJNYmIpjrw45ow+01jsqpjufcUI49n4id/sYHq8b6og==
dependencies: dependencies:
"@babel/standalone" "^7.0.0" "@babel/standalone" "^7.0.0"
bootstrap-vue "2.20.1" bootstrap-vue "2.20.1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment