diff --git a/Gemfile b/Gemfile
index 18da93d2a05..c203a98567c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -381,8 +381,6 @@ group :development, :test do
gem 'knapsack', '~> 1.17'
- gem 'stackprof', '~> 0.2.13', require: false
-
gem 'simple_po_parser', '~> 1.1.2', require: false
gem 'timecop', '~> 0.8.0'
@@ -427,6 +425,7 @@ gem 'email_reply_trimmer', '~> 0.1'
gem 'html2text'
gem 'ruby-prof', '~> 1.0.0'
+gem 'stackprof', '~> 0.2.15', require: false
gem 'rbtrace', '~> 0.4', require: false
gem 'memory_profiler', '~> 0.9', require: false
gem 'benchmark-memory', '~> 0.1', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 64e701d22de..276f9da13c7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1037,7 +1037,7 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sshkey (2.0.0)
- stackprof (0.2.13)
+ stackprof (0.2.15)
state_machines (0.5.0)
state_machines-activemodel (0.7.1)
activemodel (>= 4.1)
@@ -1382,7 +1382,7 @@ DEPENDENCIES
spring-commands-rspec (~> 1.0.4)
sprockets (~> 3.7.0)
sshkey (~> 2.0)
- stackprof (~> 0.2.13)
+ stackprof (~> 0.2.15)
state_machines-activerecord (~> 0.6.0)
sys-filesystem (~> 1.1.6)
test-prof (~> 0.10.0)
diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue
index 6eaf08e8033..4da417a37ce 100644
--- a/app/assets/javascripts/ide/components/ide_status_bar.vue
+++ b/app/assets/javascripts/ide/components/ide_status_bar.vue
@@ -2,6 +2,7 @@
/* eslint-disable @gitlab/vue-i18n/no-bare-strings */
import { mapActions, mapState, mapGetters } from 'vuex';
import IdeStatusList from 'ee_else_ce/ide/components/ide_status_list.vue';
+import IdeStatusMr from './ide_status_mr.vue';
import icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import timeAgoMixin from '~/vue_shared/mixins/timeago';
@@ -15,6 +16,7 @@ export default {
userAvatarImage,
CiIcon,
IdeStatusList,
+ IdeStatusMr,
},
directives: {
tooltip,
@@ -27,7 +29,7 @@ export default {
},
computed: {
...mapState(['currentBranchId', 'currentProjectId']),
- ...mapGetters(['currentProject', 'lastCommit']),
+ ...mapGetters(['currentProject', 'lastCommit', 'currentMergeRequest']),
...mapState('pipelines', ['latestPipeline']),
},
watch: {
@@ -121,6 +123,12 @@ export default {
>{{ lastCommitFormattedAge }}
+
diff --git a/app/assets/javascripts/ide/components/ide_status_mr.vue b/app/assets/javascripts/ide/components/ide_status_mr.vue
new file mode 100644
index 00000000000..a3b26d23a17
--- /dev/null
+++ b/app/assets/javascripts/ide/components/ide_status_mr.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+ {{ s__('WebIDE|Merge request') }}
+ {{ text }}
+
+
diff --git a/app/assets/javascripts/ide/components/merge_requests/info.vue b/app/assets/javascripts/ide/components/merge_requests/info.vue
deleted file mode 100644
index 73ec992466c..00000000000
--- a/app/assets/javascripts/ide/components/merge_requests/info.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
diff --git a/app/assets/javascripts/ide/components/panes/right.vue b/app/assets/javascripts/ide/components/panes/right.vue
index 40ed7d9c422..4a9de9e0c03 100644
--- a/app/assets/javascripts/ide/components/panes/right.vue
+++ b/app/assets/javascripts/ide/components/panes/right.vue
@@ -3,7 +3,6 @@ import { mapGetters, mapState } from 'vuex';
import { __ } from '~/locale';
import CollapsibleSidebar from './collapsible_sidebar.vue';
import { rightSidebarViews } from '../../constants';
-import MergeRequestInfo from '../merge_requests/info.vue';
import PipelinesList from '../pipelines/list.vue';
import JobsDetail from '../jobs/detail.vue';
import Clientside from '../preview/clientside.vue';
@@ -28,12 +27,6 @@ export default {
},
rightExtensionTabs() {
return [
- {
- show: Boolean(this.currentMergeRequestId),
- title: __('Merge Request'),
- views: [{ component: MergeRequestInfo, ...rightSidebarViews.mergeRequestInfo }],
- icon: 'text-description',
- },
{
show: true,
title: __('Pipelines'),
diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js
index 6144452c80b..aa44067edf8 100644
--- a/app/assets/javascripts/ide/stores/actions/merge_request.js
+++ b/app/assets/javascripts/ide/stores/actions/merge_request.js
@@ -44,9 +44,7 @@ export const getMergeRequestData = (
new Promise((resolve, reject) => {
if (!state.projects[projectId].mergeRequests[mergeRequestId] || force) {
service
- .getProjectMergeRequestData(targetProjectId || projectId, mergeRequestId, {
- render_html: true,
- })
+ .getProjectMergeRequestData(targetProjectId || projectId, mergeRequestId)
.then(({ data }) => {
commit(types.SET_MERGE_REQUEST, {
projectPath: projectId,
diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb
index 14245300633..3ae0aef0fa4 100644
--- a/app/controllers/admin/logs_controller.rb
+++ b/app/controllers/admin/logs_controller.rb
@@ -10,7 +10,7 @@ class Admin::LogsController < Admin::ApplicationController
def loggers
@loggers ||= [
- Gitlab::AppLogger,
+ Gitlab::AppJsonLogger,
Gitlab::GitLogger,
Gitlab::EnvironmentLogger,
Gitlab::SidekiqLogger,
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index daaca9e1268..c916140211e 100644
--- a/app/controllers/projects/services_controller.rb
+++ b/app/controllers/projects/services_controller.rb
@@ -8,6 +8,8 @@ class Projects::ServicesController < Projects::ApplicationController
before_action :ensure_service_enabled
before_action :service
before_action :web_hook_logs, only: [:edit, :update]
+ before_action :set_deprecation_notice_for_prometheus_service, only: [:edit, :update]
+ before_action :redirect_deprecated_prometheus_service, only: [:update]
respond_to :html
@@ -93,4 +95,16 @@ class Projects::ServicesController < Projects::ApplicationController
.as_json(only: @service.json_fields)
.merge(errors: @service.errors.as_json)
end
+
+ def redirect_deprecated_prometheus_service
+ redirect_to edit_project_service_path(project, @service) if @service.is_a?(::PrometheusService) && Feature.enabled?(:settings_operations_prometheus_service, project)
+ end
+
+ def set_deprecation_notice_for_prometheus_service
+ return if !@service.is_a?(::PrometheusService) || !Feature.enabled?(:settings_operations_prometheus_service, project)
+
+ operations_link_start = ""
+ message = s_('PrometheusService|You can now manage your Prometheus settings on the %{operations_link_start}Operations%{operations_link_end} page. Fields on this page has been deprecated.') % { operations_link_start: operations_link_start, operations_link_end: "" }
+ flash.now[:alert] = message.html_safe
+ end
end
diff --git a/app/services/concerns/akismet_methods.rb b/app/services/concerns/akismet_methods.rb
index 48c4e329944..105b79785bd 100644
--- a/app/services/concerns/akismet_methods.rb
+++ b/app/services/concerns/akismet_methods.rb
@@ -9,7 +9,7 @@ module AkismetMethods
@akismet ||= Spam::AkismetService.new(
spammable_owner.name,
spammable_owner.email,
- spammable.spammable_text,
+ spammable.try(:spammable_text) || spammable&.text,
options
)
end
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb
index 6cb84458d9b..b59bb803778 100644
--- a/app/services/issuable_base_service.rb
+++ b/app/services/issuable_base_service.rb
@@ -11,10 +11,14 @@ class IssuableBaseService < BaseService
@skip_milestone_email = @params.delete(:skip_milestone_email)
end
- def filter_params(issuable)
+ def can_admin_issuable?(issuable)
ability_name = :"admin_#{issuable.to_ability_name}"
- unless can?(current_user, ability_name, issuable)
+ can?(current_user, ability_name, issuable)
+ end
+
+ def filter_params(issuable)
+ unless can_admin_issuable?(issuable)
params.delete(:milestone_id)
params.delete(:labels)
params.delete(:add_label_ids)
diff --git a/app/services/spam/ham_service.rb b/app/services/spam/ham_service.rb
index e8444ba8f93..d0f53eea90c 100644
--- a/app/services/spam/ham_service.rb
+++ b/app/services/spam/ham_service.rb
@@ -2,10 +2,17 @@
module Spam
class HamService
- attr_accessor :spam_log
+ include AkismetMethods
+
+ attr_accessor :spam_log, :options
def initialize(spam_log)
@spam_log = spam_log
+ @user = spam_log.user
+ @options = {
+ ip_address: spam_log.source_ip,
+ user_agent: spam_log.user_agent
+ }
end
def execute
@@ -16,17 +23,6 @@ module Spam
end
end
- private
-
- def akismet
- user = spam_log.user
- @akismet ||= AkismetService.new(
- user.name,
- user.email,
- spam_log.text,
- ip_address: spam_log.source_ip,
- user_agent: spam_log.user_agent
- )
- end
+ alias_method :spammable, :spam_log
end
end
diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb
index 7e3f7275b55..6e4ffa36854 100644
--- a/app/workers/stuck_ci_jobs_worker.rb
+++ b/app/workers/stuck_ci_jobs_worker.rb
@@ -2,7 +2,7 @@
class StuckCiJobsWorker
include ApplicationWorker
- include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
+ include CronjobQueue
feature_category :continuous_integration
worker_resource_boundary :cpu
@@ -56,13 +56,13 @@ class StuckCiJobsWorker
loop do
jobs = Ci::Build.where(status: status)
.where(condition, timeout.ago)
- .includes(:tags, :runner, project: :namespace)
+ .includes(:tags, :runner, project: [:namespace, :route])
.limit(100)
.to_a
break if jobs.empty?
jobs.each do |job|
- yield(job)
+ with_context(project: job.project) { yield(job) }
end
end
end
diff --git a/changelogs/unreleased/196070-move-mr-from-right-sidebar-to-bottom-bar.yml b/changelogs/unreleased/196070-move-mr-from-right-sidebar-to-bottom-bar.yml
new file mode 100644
index 00000000000..bb5972a2dd6
--- /dev/null
+++ b/changelogs/unreleased/196070-move-mr-from-right-sidebar-to-bottom-bar.yml
@@ -0,0 +1,5 @@
+---
+title: Move Merge Request from right sidebar of Web IDE to bottom bar
+merge_request: 24746
+author:
+type: changed
diff --git a/changelogs/unreleased/ag-addjson-log-to-admin-logs.yml b/changelogs/unreleased/ag-addjson-log-to-admin-logs.yml
new file mode 100644
index 00000000000..1f4dfa2fbf5
--- /dev/null
+++ b/changelogs/unreleased/ag-addjson-log-to-admin-logs.yml
@@ -0,0 +1,5 @@
+---
+title: Replace unstructured application logs with structured (JSON) application logs in the admin interface
+merge_request: 24614
+author:
+type: other
diff --git a/changelogs/unreleased/mwaw-rename_to_long_migration_filename.yml b/changelogs/unreleased/mwaw-rename_to_long_migration_filename.yml
new file mode 100644
index 00000000000..bc6042efd27
--- /dev/null
+++ b/changelogs/unreleased/mwaw-rename_to_long_migration_filename.yml
@@ -0,0 +1,5 @@
+---
+title: Rename too long migration filename to address gem packaging limitations.
+merge_request:
+author:
+type: fixed
diff --git a/changelogs/unreleased/sh-promote-stackprof.yml b/changelogs/unreleased/sh-promote-stackprof.yml
new file mode 100644
index 00000000000..6c2af132d60
--- /dev/null
+++ b/changelogs/unreleased/sh-promote-stackprof.yml
@@ -0,0 +1,5 @@
+---
+title: Promote stackprof into a production gem
+merge_request: 24564
+author:
+type: other
diff --git a/db/migrate/20200116051619_drop_activate_prometheus_services_for_shared_cluster_applications_background_migration.rb b/db/migrate/20200116051619_drop_background_migration_jobs.rb
similarity index 79%
rename from db/migrate/20200116051619_drop_activate_prometheus_services_for_shared_cluster_applications_background_migration.rb
rename to db/migrate/20200116051619_drop_background_migration_jobs.rb
index 39f450be716..f492ec0af9d 100644
--- a/db/migrate/20200116051619_drop_activate_prometheus_services_for_shared_cluster_applications_background_migration.rb
+++ b/db/migrate/20200116051619_drop_background_migration_jobs.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class DropActivatePrometheusServicesForSharedClusterApplicationsBackgroundMigration < ActiveRecord::Migration[5.2]
+class DropBackgroundMigrationJobs < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
diff --git a/db/migrate/20200131181354_add_health_status_to_epics.rb b/db/migrate/20200131181354_add_health_status_to_epics.rb
new file mode 100644
index 00000000000..4e5f9ab138d
--- /dev/null
+++ b/db/migrate/20200131181354_add_health_status_to_epics.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddHealthStatusToEpics < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :epics, :health_status, :integer, limit: 2
+ end
+end
diff --git a/db/migrate/20200131191754_add_health_status_to_issues.rb b/db/migrate/20200131191754_add_health_status_to_issues.rb
new file mode 100644
index 00000000000..ca4e797f4b7
--- /dev/null
+++ b/db/migrate/20200131191754_add_health_status_to_issues.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddHealthStatusToIssues < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :issues, :health_status, :integer, limit: 2
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8d51dbb43a0..6ddf61799e3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1554,6 +1554,7 @@ ActiveRecord::Schema.define(version: 2020_02_07_151640) do
t.integer "state_id", limit: 2, default: 1, null: false
t.integer "start_date_sourcing_epic_id"
t.integer "due_date_sourcing_epic_id"
+ t.integer "health_status", limit: 2
t.index ["assignee_id"], name: "index_epics_on_assignee_id"
t.index ["author_id"], name: "index_epics_on_author_id"
t.index ["closed_by_id"], name: "index_epics_on_closed_by_id"
@@ -2181,6 +2182,7 @@ ActiveRecord::Schema.define(version: 2020_02_07_151640) do
t.integer "state_id", limit: 2, default: 1, null: false
t.integer "duplicated_to_id"
t.integer "promoted_to_epic_id"
+ t.integer "health_status", limit: 2
t.index ["author_id"], name: "index_issues_on_author_id"
t.index ["closed_by_id"], name: "index_issues_on_closed_by_id"
t.index ["confidential"], name: "index_issues_on_confidential"
diff --git a/lib/gitlab/profiler/total_time_flat_printer.rb b/lib/gitlab/profiler/total_time_flat_printer.rb
index 2c105d2722b..9846bad3c08 100644
--- a/lib/gitlab/profiler/total_time_flat_printer.rb
+++ b/lib/gitlab/profiler/total_time_flat_printer.rb
@@ -24,7 +24,7 @@ module Gitlab
sum += method.self_time
- @output << "%6.2f %9.3f %9.3f %9.3f %9.3f %8d %s%s\n" % [
+ @output << "%6.2f %9.3f %9.3f %9.3f %9.3f %8d %s%-30s %s\n" % [
method.self_time / total_time * 100, # %self
method.total_time, # total
method.self_time, # self
@@ -32,7 +32,8 @@ module Gitlab
method.children_time, # children
method.called, # calls
method.recursive? ? "*" : " ", # cycle
- method_name(method) # name
+ method.full_name, # method_name
+ method_location(method) # location
]
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 33d081d7d4c..0274679fd2c 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -15235,6 +15235,9 @@ msgstr ""
msgid "PrometheusService|Waiting for your first deployment to an environment to find common metrics"
msgstr ""
+msgid "PrometheusService|You can now manage your Prometheus settings on the %{operations_link_start}Operations%{operations_link_end} page. Fields on this page has been deprecated."
+msgstr ""
+
msgid "Promote"
msgstr ""
@@ -21435,6 +21438,9 @@ msgstr ""
msgid "Web terminal"
msgstr ""
+msgid "WebIDE|Merge request"
+msgstr ""
+
msgid "Webhooks"
msgstr ""
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/close_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/close_issue_spec.rb
index d075dc742e2..864e4d0edd0 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/close_issue_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/close_issue_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module QA
- context 'Plan', :reliable do
+ context 'Plan' do
describe 'Close issue' do
let(:issue) do
Resource::Issue.fabricate_via_api!
diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb
index b76d350ebbc..b6c64a964a6 100644
--- a/spec/controllers/projects/services_controller_spec.rb
+++ b/spec/controllers/projects/services_controller_spec.rb
@@ -191,16 +191,81 @@ describe Projects::ServicesController do
end
end
end
+
+ context 'Prometheus service' do
+ let!(:service) { create(:prometheus_service, project: project) }
+ let(:service_params) { { manual_configuration: '1', api_url: 'http://example.com' } }
+
+ context 'feature flag :settings_operations_prometheus_service is enabled' do
+ before do
+ stub_feature_flags(settings_operations_prometheus_service: true)
+ end
+
+ it 'redirects user back to edit page with alert' do
+ put :update, params: project_params.merge(service: service_params)
+
+ expect(response).to redirect_to(edit_project_service_path(project, service))
+ expected_alert = "You can now manage your Prometheus settings on the Operations page. Fields on this page has been deprecated."
+
+ expect(response).to set_flash.now[:alert].to(expected_alert)
+ end
+
+ it 'does not modify service' do
+ expect { put :update, params: project_params.merge(service: service_params) }.not_to change { project.prometheus_service.reload.attributes }
+ end
+ end
+
+ context 'feature flag :settings_operations_prometheus_service is disabled' do
+ before do
+ stub_feature_flags(settings_operations_prometheus_service: false)
+ end
+
+ it 'modifies service' do
+ expect { put :update, params: project_params.merge(service: service_params) }.to change { project.prometheus_service.reload.attributes }
+ end
+ end
+ end
end
describe 'GET #edit' do
- before do
- get :edit, params: project_params(id: 'jira')
+ context 'Jira service' do
+ let(:service_param) { 'jira' }
+
+ before do
+ get :edit, params: project_params(id: service_param)
+ end
+
+ context 'with approved services' do
+ it 'renders edit page' do
+ expect(response).to be_successful
+ end
+ end
end
- context 'with approved services' do
- it 'renders edit page' do
- expect(response).to be_successful
+ context 'Prometheus service' do
+ let(:service_param) { 'prometheus' }
+
+ context 'feature flag :settings_operations_prometheus_service is enabled' do
+ before do
+ stub_feature_flags(settings_operations_prometheus_service: true)
+ get :edit, params: project_params(id: service_param)
+ end
+
+ it 'renders deprecation warning notice' do
+ expected_alert = "You can now manage your Prometheus settings on the Operations page. Fields on this page has been deprecated."
+ expect(response).to set_flash.now[:alert].to(expected_alert)
+ end
+ end
+
+ context 'feature flag :settings_operations_prometheus_service is disabled' do
+ before do
+ stub_feature_flags(settings_operations_prometheus_service: false)
+ get :edit, params: project_params(id: service_param)
+ end
+
+ it 'does not render deprecation warning notice' do
+ expect(response).not_to set_flash.now[:alert]
+ end
end
end
end
diff --git a/spec/features/admin/admin_browses_logs_spec.rb b/spec/features/admin/admin_browses_logs_spec.rb
index 2b97362c8e9..45e860e1536 100644
--- a/spec/features/admin/admin_browses_logs_spec.rb
+++ b/spec/features/admin/admin_browses_logs_spec.rb
@@ -10,7 +10,7 @@ describe 'Admin browses logs' do
it 'shows available log files' do
visit admin_logs_path
- expect(page).to have_link 'application.log'
+ expect(page).to have_link 'application_json.log'
expect(page).to have_link 'git_json.log'
expect(page).to have_link 'test.log'
expect(page).to have_link 'sidekiq.log'
diff --git a/spec/features/projects/services/user_activates_prometheus_spec.rb b/spec/features/projects/services/user_activates_prometheus_spec.rb
index a83d3e2e8be..ab372d532aa 100644
--- a/spec/features/projects/services/user_activates_prometheus_spec.rb
+++ b/spec/features/projects/services/user_activates_prometheus_spec.rb
@@ -15,11 +15,12 @@ describe 'User activates Prometheus' do
click_link('Prometheus')
end
- it 'activates service' do
+ it 'does not activate service and informs about deprecation' do
check('Active')
fill_in('API URL', with: 'http://prometheus.example.com')
click_button('Save changes')
- expect(page).to have_content('Prometheus activated.')
+ expect(page).not_to have_content('Prometheus activated.')
+ expect(page).to have_content('Fields on this page has been deprecated.')
end
end
diff --git a/spec/frontend/ide/components/ide_status_mr_spec.js b/spec/frontend/ide/components/ide_status_mr_spec.js
new file mode 100644
index 00000000000..4d9ad61201d
--- /dev/null
+++ b/spec/frontend/ide/components/ide_status_mr_spec.js
@@ -0,0 +1,59 @@
+import { shallowMount } from '@vue/test-utils';
+import { GlIcon, GlLink } from '@gitlab/ui';
+import { TEST_HOST } from 'helpers/test_constants';
+import IdeStatusMr from '~/ide/components/ide_status_mr.vue';
+
+const TEST_TEXT = '!9001';
+const TEST_URL = `${TEST_HOST}merge-requests/9001`;
+
+describe('ide/components/ide_status_mr', () => {
+ let wrapper;
+
+ const createComponent = props => {
+ wrapper = shallowMount(IdeStatusMr, {
+ propsData: props,
+ });
+ };
+ const findIcon = () => wrapper.find(GlIcon);
+ const findLink = () => wrapper.find(GlLink);
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ describe('when mounted', () => {
+ beforeEach(() => {
+ createComponent({
+ text: TEST_TEXT,
+ url: TEST_URL,
+ });
+ });
+
+ it('renders icon', () => {
+ const icon = findIcon();
+
+ expect(icon.exists()).toBe(true);
+ expect(icon.props()).toEqual(
+ expect.objectContaining({
+ name: 'merge-request',
+ }),
+ );
+ });
+
+ it('renders link', () => {
+ const link = findLink();
+
+ expect(link.exists()).toBe(true);
+ expect(link.attributes()).toEqual(
+ expect.objectContaining({
+ href: TEST_URL,
+ }),
+ );
+ expect(link.text()).toEqual(TEST_TEXT);
+ });
+
+ it('renders text', () => {
+ expect(wrapper.text()).toBe(`Merge request ${TEST_TEXT}`);
+ });
+ });
+});
diff --git a/spec/frontend/ide/components/panes/right_spec.js b/spec/frontend/ide/components/panes/right_spec.js
index 7e408be96fc..84b2d440b60 100644
--- a/spec/frontend/ide/components/panes/right_spec.js
+++ b/spec/frontend/ide/components/panes/right_spec.js
@@ -75,28 +75,6 @@ describe('ide/components/panes/right.vue', () => {
});
});
- describe('merge request tab', () => {
- it('is shown if there is a currentMergeRequestId', () => {
- store.state.currentMergeRequestId = 1;
-
- createComponent();
-
- expect(wrapper.find(CollapsibleSidebar).props('extensionTabs')).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- show: true,
- title: 'Merge Request',
- views: expect.arrayContaining([
- expect.objectContaining({
- name: rightSidebarViews.mergeRequestInfo.name,
- }),
- ]),
- }),
- ]),
- );
- });
- });
-
describe('clientside live preview tab', () => {
it('is shown if there is a packageJson and clientsidePreviewEnabled', () => {
Vue.set(store.state.entries, 'package.json', {
diff --git a/spec/javascripts/ide/components/ide_status_bar_spec.js b/spec/javascripts/ide/components/ide_status_bar_spec.js
index 69f163574fb..3facf1c266a 100644
--- a/spec/javascripts/ide/components/ide_status_bar_spec.js
+++ b/spec/javascripts/ide/components/ide_status_bar_spec.js
@@ -1,94 +1,129 @@
import Vue from 'vue';
+import _ from 'lodash';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
-import store from '~/ide/stores';
-import ideStatusBar from '~/ide/components/ide_status_bar.vue';
+import { TEST_HOST } from 'spec/test_constants';
+import { createStore } from '~/ide/stores';
+import IdeStatusBar from '~/ide/components/ide_status_bar.vue';
import { rightSidebarViews } from '~/ide/constants';
-import { resetStore } from '../helpers';
import { projectData } from '../mock_data';
+const TEST_PROJECT_ID = 'abcproject';
+const TEST_MERGE_REQUEST_ID = '9001';
+const TEST_MERGE_REQUEST_URL = `${TEST_HOST}merge-requests/${TEST_MERGE_REQUEST_ID}`;
+
describe('ideStatusBar', () => {
+ let store;
let vm;
+ const createComponent = () => {
+ vm = createComponentWithStore(Vue.extend(IdeStatusBar), store).$mount();
+ };
+ const findMRStatus = () => vm.$el.querySelector('.js-ide-status-mr');
+
beforeEach(() => {
- const Component = Vue.extend(ideStatusBar);
-
- store.state.currentProjectId = 'abcproject';
- store.state.projects.abcproject = projectData;
+ store = createStore();
+ store.state.currentProjectId = TEST_PROJECT_ID;
+ store.state.projects[TEST_PROJECT_ID] = _.clone(projectData);
store.state.currentBranchId = 'master';
-
- vm = createComponentWithStore(Component, store).$mount();
});
afterEach(() => {
vm.$destroy();
-
- resetStore(vm.$store);
});
- it('renders the statusbar', () => {
- expect(vm.$el.className).toBe('ide-status-bar');
- });
+ describe('default', () => {
+ beforeEach(() => {
+ createComponent();
+ });
- describe('mounted', () => {
it('triggers a setInterval', () => {
expect(vm.intervalId).not.toBe(null);
});
- });
- describe('commitAgeUpdate', () => {
- beforeEach(function() {
- jasmine.clock().install();
- spyOn(vm, 'commitAgeUpdate').and.callFake(() => {});
- vm.startTimer();
+ it('renders the statusbar', () => {
+ expect(vm.$el.className).toBe('ide-status-bar');
});
- afterEach(function() {
- jasmine.clock().uninstall();
- });
-
- it('gets called every second', () => {
- expect(vm.commitAgeUpdate).not.toHaveBeenCalled();
-
- jasmine.clock().tick(1100);
-
- expect(vm.commitAgeUpdate.calls.count()).toEqual(1);
-
- jasmine.clock().tick(1000);
-
- expect(vm.commitAgeUpdate.calls.count()).toEqual(2);
- });
- });
-
- describe('getCommitPath', () => {
- it('returns the path to the commit details', () => {
- expect(vm.getCommitPath('abc123de')).toBe('/commit/abc123de');
- });
- });
-
- describe('pipeline status', () => {
- it('opens right sidebar on clicking icon', done => {
- spyOn(vm, 'openRightPane');
- Vue.set(vm.$store.state.pipelines, 'latestPipeline', {
- details: {
- status: {
- text: 'success',
- details_path: 'test',
- icon: 'status_success',
- },
- },
- commit: {
- author_gravatar_url: 'www',
- },
+ describe('commitAgeUpdate', () => {
+ beforeEach(function() {
+ jasmine.clock().install();
+ spyOn(vm, 'commitAgeUpdate').and.callFake(() => {});
+ vm.startTimer();
});
- vm.$nextTick()
- .then(() => {
- vm.$el.querySelector('.ide-status-pipeline button').click();
+ afterEach(function() {
+ jasmine.clock().uninstall();
+ });
- expect(vm.openRightPane).toHaveBeenCalledWith(rightSidebarViews.pipelines);
- })
- .then(done)
- .catch(done.fail);
+ it('gets called every second', () => {
+ expect(vm.commitAgeUpdate).not.toHaveBeenCalled();
+
+ jasmine.clock().tick(1100);
+
+ expect(vm.commitAgeUpdate.calls.count()).toEqual(1);
+
+ jasmine.clock().tick(1000);
+
+ expect(vm.commitAgeUpdate.calls.count()).toEqual(2);
+ });
+ });
+
+ describe('getCommitPath', () => {
+ it('returns the path to the commit details', () => {
+ expect(vm.getCommitPath('abc123de')).toBe('/commit/abc123de');
+ });
+ });
+
+ describe('pipeline status', () => {
+ it('opens right sidebar on clicking icon', done => {
+ spyOn(vm, 'openRightPane');
+ Vue.set(vm.$store.state.pipelines, 'latestPipeline', {
+ details: {
+ status: {
+ text: 'success',
+ details_path: 'test',
+ icon: 'status_success',
+ },
+ },
+ commit: {
+ author_gravatar_url: 'www',
+ },
+ });
+
+ vm.$nextTick()
+ .then(() => {
+ vm.$el.querySelector('.ide-status-pipeline button').click();
+
+ expect(vm.openRightPane).toHaveBeenCalledWith(rightSidebarViews.pipelines);
+ })
+ .then(done)
+ .catch(done.fail);
+ });
+ });
+
+ it('does not show merge request status', () => {
+ expect(findMRStatus()).toBe(null);
+ });
+ });
+
+ describe('with merge request in store', () => {
+ beforeEach(() => {
+ store.state.projects[TEST_PROJECT_ID].mergeRequests = {
+ [TEST_MERGE_REQUEST_ID]: {
+ web_url: TEST_MERGE_REQUEST_URL,
+ references: {
+ short: `!${TEST_MERGE_REQUEST_ID}`,
+ },
+ },
+ };
+ store.state.currentMergeRequestId = TEST_MERGE_REQUEST_ID;
+
+ createComponent();
+ });
+
+ it('shows merge request status', () => {
+ expect(findMRStatus().textContent.trim()).toEqual(`Merge request !${TEST_MERGE_REQUEST_ID}`);
+ expect(findMRStatus().querySelector('a').href).toEqual(TEST_MERGE_REQUEST_URL);
});
});
});
diff --git a/spec/javascripts/ide/components/merge_requests/info_spec.js b/spec/javascripts/ide/components/merge_requests/info_spec.js
deleted file mode 100644
index 98a29e5128b..00000000000
--- a/spec/javascripts/ide/components/merge_requests/info_spec.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import Vue from 'vue';
-import '~/behaviors/markdown/render_gfm';
-import { createStore } from '~/ide/stores';
-import Info from '~/ide/components/merge_requests/info.vue';
-import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper';
-
-describe('IDE merge request details', () => {
- let Component;
- let vm;
-
- beforeAll(() => {
- Component = Vue.extend(Info);
- });
-
- beforeEach(() => {
- const store = createStore();
- store.state.currentProjectId = 'gitlab-ce';
- store.state.currentMergeRequestId = 1;
- store.state.projects['gitlab-ce'] = {
- mergeRequests: {
- 1: {
- iid: 1,
- title: 'Testing',
- title_html: 'Testing',
- description: 'Description',
- description_html: '
Description HTML
',
- },
- },
- };
-
- vm = createComponentWithStore(Component, store).$mount();
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('renders merge request IID', () => {
- expect(vm.$el.querySelector('.detail-page-header').textContent).toContain('!1');
- });
-
- it('renders title as HTML', () => {
- expect(vm.$el.querySelector('.title-html')).not.toBe(null);
- expect(vm.$el.querySelector('.title').textContent).toContain('Testing');
- });
-
- it('renders description as HTML', () => {
- expect(vm.$el.querySelector('.description-html')).not.toBe(null);
- expect(vm.$el.querySelector('.description').textContent).toContain('Description HTML');
- });
-});
diff --git a/spec/javascripts/ide/stores/actions/merge_request_spec.js b/spec/javascripts/ide/stores/actions/merge_request_spec.js
index ee0e51003c5..498e5142f0c 100644
--- a/spec/javascripts/ide/stores/actions/merge_request_spec.js
+++ b/spec/javascripts/ide/stores/actions/merge_request_spec.js
@@ -137,9 +137,7 @@ describe('IDE store merge request actions', () => {
store
.dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
- expect(service.getProjectMergeRequestData).toHaveBeenCalledWith(TEST_PROJECT, 1, {
- render_html: true,
- });
+ expect(service.getProjectMergeRequestData).toHaveBeenCalledWith(TEST_PROJECT, 1);
done();
})
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index 86bf5710635..7695617cb57 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -30,6 +30,7 @@ Issue:
- last_edited_at
- last_edited_by_id
- discussion_locked
+- health_status
Event:
- id
- target_type
@@ -824,3 +825,4 @@ Epic:
- state_id
- start_date_sourcing_epic_id
- due_date_sourcing_epic_id
+ - health_status
diff --git a/spec/lib/gitlab/profiler_spec.rb b/spec/lib/gitlab/profiler_spec.rb
index 8f6fb6eda65..0186d48fd1b 100644
--- a/spec/lib/gitlab/profiler_spec.rb
+++ b/spec/lib/gitlab/profiler_spec.rb
@@ -192,4 +192,43 @@ describe Gitlab::Profiler do
expect(described_class.log_load_times_by_model(null_logger)).to be_nil
end
end
+
+ describe '.print_by_total_time' do
+ let(:stdout) { StringIO.new }
+
+ let(:output) do
+ stdout.rewind
+ stdout.read
+ end
+
+ let_it_be(:result) do
+ RubyProf.profile do
+ sleep 0.1
+ 1.to_s
+ end
+ end
+
+ before do
+ stub_const('STDOUT', stdout)
+ end
+
+ it 'prints a profile result sorted by total time' do
+ described_class.print_by_total_time(result)
+
+ total_times =
+ output
+ .scan(/^\s+\d+\.\d+\s+(\d+\.\d+)/)
+ .map { |(total)| total.to_f }
+
+ expect(output).to include('Kernel#sleep')
+ expect(total_times).to eq(total_times.sort.reverse)
+ expect(total_times).not_to eq(total_times.uniq)
+ end
+
+ it 'accepts a max_percent option' do
+ described_class.print_by_total_time(result, max_percent: 50)
+
+ expect(output).not_to include('Kernel#sleep')
+ end
+ end
end
diff --git a/spec/migrations/drop_activate_prometheus_services_for_shared_cluster_applications_background_migration_spec.rb b/spec/migrations/drop_background_migration_jobs_spec.rb
similarity index 89%
rename from spec/migrations/drop_activate_prometheus_services_for_shared_cluster_applications_background_migration_spec.rb
rename to spec/migrations/drop_background_migration_jobs_spec.rb
index 5851b26dba4..ac76e897f6c 100644
--- a/spec/migrations/drop_activate_prometheus_services_for_shared_cluster_applications_background_migration_spec.rb
+++ b/spec/migrations/drop_background_migration_jobs_spec.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require 'spec_helper'
-require Rails.root.join('db', 'migrate', '20200116051619_drop_activate_prometheus_services_for_shared_cluster_applications_background_migration.rb')
+require Rails.root.join('db', 'migrate', '20200116051619_drop_background_migration_jobs.rb')
-describe DropActivatePrometheusServicesForSharedClusterApplicationsBackgroundMigration, :sidekiq, :redis, :migration, schema: 2020_01_16_051619 do
+describe DropBackgroundMigrationJobs, :sidekiq, :redis, :migration, schema: 2020_01_16_051619 do
subject(:migration) { described_class.new }
describe '#up' do
diff --git a/tooling/overcommit/gems.locked b/tooling/overcommit/gems.locked
index 36e03551815..15b80426c03 100644
--- a/tooling/overcommit/gems.locked
+++ b/tooling/overcommit/gems.locked
@@ -72,4 +72,4 @@ DEPENDENCIES
scss_lint (~> 0.56.0)
BUNDLED WITH
- 2.1.2
+ 1.17.3