Commit 64704e59 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents cca95f0d 0e126969
......@@ -10,7 +10,6 @@ import IssuesList from './issues_list.vue';
import Modal from './modal.vue';
import createStore from '../store';
import Tracking from '~/tracking';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import {
summaryTextBuilder,
reportTextBuilder,
......@@ -28,7 +27,7 @@ export default {
Modal,
GlButton,
},
mixins: [glFeatureFlagsMixin(), Tracking.mixin()],
mixins: [Tracking.mixin()],
props: {
endpoint: {
type: String,
......@@ -92,7 +91,7 @@ export default {
return reportTextBuilder(name, summary);
},
hasRecentFailures(summary) {
return this.glFeatures.testFailureHistory && summary?.recentlyFailed > 0;
return summary?.recentlyFailed > 0;
},
recentFailuresText(summary) {
return recentFailuresTextBuilder(summary);
......
<script>
import { mapActions } from 'vuex';
import { GlBadge, GlSprintf } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
name: 'TestIssueBody',
......@@ -9,7 +8,6 @@ export default {
GlBadge,
GlSprintf,
},
mixins: [glFeatureFlagsMixin()],
props: {
issue: {
type: Object,
......@@ -28,11 +26,7 @@ export default {
},
computed: {
showRecentFailures() {
return (
this.glFeatures.testFailureHistory &&
this.issue.recent_failures?.count &&
this.issue.recent_failures?.base_branch
);
return this.issue.recent_failures?.count && this.issue.recent_failures?.base_branch;
},
},
methods: {
......
......@@ -168,6 +168,20 @@ body.gl-dark {
--black: #{$black};
--svg-status-bg: #{$white};
.gl-button.gl-button,
.gl-button.gl-button.btn-block {
&.btn-default,
&.btn-dashed,
&.btn-info,
&.btn-success,
&.btn-danger,
&.btn-warning {
&-tertiary {
mix-blend-mode: screen;
}
}
}
}
$border-white-light: $gray-900;
......
......@@ -39,7 +39,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:core_security_mr_widget_counts, @project)
push_frontend_feature_flag(:core_security_mr_widget_downloads, @project, default_enabled: true)
push_frontend_feature_flag(:remove_resolve_note, @project, default_enabled: true)
push_frontend_feature_flag(:test_failure_history, @project)
push_frontend_feature_flag(:diffs_gradual_load, @project, default_enabled: true)
push_frontend_feature_flag(:codequality_mr_diff, @project)
......
......@@ -30,7 +30,6 @@ module Ci
end
def should_track_failures?
return false unless Feature.enabled?(:test_failure_history, project)
return false unless project.default_branch_or_master == pipeline.ref
# We fetch for up to MAX_TRACKABLE_FAILURES + 1 builds. So if ever we get
......
......@@ -64,10 +64,6 @@ module MergeRequests
return ServiceResponse.error(message: 'Merge request is not mergeable')
end
unless merge_ref_auto_sync_enabled?
return ServiceResponse.error(message: 'Merge ref is outdated due to disabled feature')
end
unless payload.fetch(:merge_ref_head)
return ServiceResponse.error(message: 'Merge ref cannot be updated')
end
......@@ -142,7 +138,6 @@ module MergeRequests
#
# Returns true if the merge-ref does not exists or is out of sync.
def outdated_merge_ref?
return false unless merge_ref_auto_sync_enabled?
return false unless merge_request.open?
return true unless ref_head = merge_request.merge_ref_head
......@@ -157,17 +152,11 @@ module MergeRequests
end
def merge_to_ref
return true unless merge_ref_auto_sync_enabled?
params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) }
result = MergeRequests::MergeToRefService.new(project, merge_request.author, params).execute(merge_request)
result[:status] == :success
end
def merge_ref_auto_sync_enabled?
Feature.enabled?(:merge_ref_auto_sync, project, default_enabled: true)
end
def merge_ref_auto_sync_lock_enabled?
Feature.enabled?(:merge_ref_auto_sync_lock, project, default_enabled: true)
end
......
......@@ -11,18 +11,11 @@ module Gitlab
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
waiter =
if Feature.enabled?(:github_import_pull_request_reviews, project, default_enabled: true)
waiter = Importer::PullRequestsReviewsImporter
.new(project, client)
.execute
waiter = Importer::PullRequestsReviewsImporter
.new(project, client)
.execute
project.import_state.refresh_jid_expiration
waiter
else
JobWaiter.new
end
project.import_state.refresh_jid_expiration
AdvanceStageWorker.perform_async(
project.id,
......
---
title: Remove test_failure_history flag
merge_request: 51464
author:
type: changed
---
title: Fix tertiary button color in dark mode
merge_request: 51349
author:
type: fixed
---
name: github_import_pull_request_reviews
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48632
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/289153
milestone: '13.7'
type: development
group: group::import
default_enabled: true
---
name: merge_ref_auto_sync
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29569
rollout_issue_url:
milestone: '12.1'
type: development
group: group::code review
default_enabled: true
---
name: test_failure_history
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45027
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268249
milestone: '13.6'
type: development
group: group::testing
default_enabled: false
......@@ -68,36 +68,11 @@ execution time and the error output.
### Number of recent failures
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/241759) in GitLab 13.7.
> - It's [deployed behind a feature flag](../user/feature_flags.md), disabled by default.
> - It's disabled on GitLab.com.
> - It's not recommended for production use.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-the-number-of-recent-failures). **(CORE ONLY)**
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/268249) in GitLab 13.8.
If a test failed in the project's default branch in the last 14 days, a message like
`Failed {n} time(s) in {default_branch} in the last 14 days` is displayed for that test.
#### Enable or disable the number of recent failures **(CORE ONLY)**
Displaying the number of failures in the last 14 days is under development and not
ready for production use. It is deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../administration/feature_flags.md)
can enable it.
To enable it:
```ruby
Feature.enable(:test_failure_history)
```
To disable it:
```ruby
Feature.disable(:test_failure_history)
```
## How to set it up
To enable the Unit test reports in merge requests, you need to add
......
......@@ -12,8 +12,6 @@ module Gitlab
end
def load!
return unless Feature.enabled?(:test_failure_history, project)
recent_failures_count.each do |key_hash, count|
failed_test_cases[key_hash].set_recent_failures(count, project.default_branch_or_master)
end
......
......@@ -22,7 +22,7 @@ describe('Grouped test reports app', () => {
let wrapper;
let mockStore;
const mountComponent = ({ props = { pipelinePath }, testFailureHistory = false } = {}) => {
const mountComponent = ({ props = { pipelinePath } } = {}) => {
wrapper = mount(Component, {
store: mockStore,
localVue,
......@@ -31,11 +31,6 @@ describe('Grouped test reports app', () => {
pipelinePath,
...props,
},
provide: {
glFeatures: {
testFailureHistory,
},
},
});
};
......@@ -242,50 +237,25 @@ describe('Grouped test reports app', () => {
describe('with recent failures counts', () => {
beforeEach(() => {
setReports(recentFailuresTestReports);
mountComponent();
});
describe('with feature flag enabled', () => {
beforeEach(() => {
mountComponent({ testFailureHistory: true });
});
it('renders the recently failed tests summary', () => {
expect(findHeader().text()).toContain(
'2 out of 3 failed tests have failed more than once in the last 14 days',
);
});
it('renders the recently failed count on the test suite', () => {
expect(findSummaryDescription().text()).toContain(
'1 out of 2 failed tests has failed more than once in the last 14 days',
);
});
it('renders the recent failures count on the test case', () => {
expect(findIssueDescription().text()).toContain(
'Failed 8 times in master in the last 14 days',
);
});
it('renders the recently failed tests summary', () => {
expect(findHeader().text()).toContain(
'2 out of 3 failed tests have failed more than once in the last 14 days',
);
});
describe('with feature flag disabled', () => {
beforeEach(() => {
mountComponent({ testFailureHistory: false });
});
it('does not render the recently failed tests summary', () => {
expect(findHeader().text()).not.toContain('failed more than once in the last 14 days');
});
it('does not render the recently failed count on the test suite', () => {
expect(findSummaryDescription().text()).not.toContain(
'failed more than once in the last 14 days',
);
});
it('renders the recently failed count on the test suite', () => {
expect(findSummaryDescription().text()).toContain(
'1 out of 2 failed tests has failed more than once in the last 14 days',
);
});
it('renders the recent failures count on the test case', () => {
expect(findIssueDescription().text()).not.toContain('in the last 14 days');
});
it('renders the recent failures count on the test case', () => {
expect(findIssueDescription().text()).toContain(
'Failed 8 times in master in the last 14 days',
);
});
});
......
......@@ -28,18 +28,5 @@ RSpec.describe Gitlab::Ci::Reports::TestFailureHistory, :aggregate_failures do
expect(failed_rspec.recent_failures).to eq(count: 2, base_branch: 'master')
expect(failed_java.recent_failures).to eq(count: 1, base_branch: 'master')
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(test_failure_history: false)
end
it 'does not set recent failures' do
load_history
expect(failed_rspec.recent_failures).to be_nil
expect(failed_java.recent_failures).to be_nil
end
end
end
end
......@@ -22,19 +22,6 @@ RSpec.describe Ci::TestFailureHistoryService, :aggregate_failures do
expect(Ci::TestCaseFailure.count).to eq(2)
end
context 'when feature flag for test failure history is disabled' do
before do
stub_feature_flags(test_failure_history: false)
end
it 'does not persist data' do
execute_service
expect(Ci::TestCase.count).to eq(0)
expect(Ci::TestCaseFailure.count).to eq(0)
end
end
context 'when pipeline is not for the default branch' do
before do
pipeline.update_column(:ref, 'new-feature')
......@@ -136,14 +123,6 @@ RSpec.describe Ci::TestFailureHistoryService, :aggregate_failures do
it { is_expected.to eq(true) }
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(test_failure_history: false)
end
it { is_expected.to eq(false) }
end
context 'when pipeline is not equal to the project default branch' do
before do
pipeline.update_column(:ref, 'some-other-branch')
......
......@@ -167,25 +167,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
end
end
context 'disabled merge ref sync feature flag' do
before do
stub_feature_flags(merge_ref_auto_sync: false)
end
it 'returns error and no payload' do
result = subject
expect(result).to be_a(ServiceResponse)
expect(result.error?).to be(true)
expect(result.message).to eq('Merge ref is outdated due to disabled feature')
expect(result.payload).to be_empty
end
it 'ignores merge-ref and updates merge status' do
expect { subject }.to change(merge_request, :merge_status).from('unchecked').to('can_be_merged')
end
end
context 'when broken' do
before do
expect(merge_request).to receive(:broken?) { true }
......@@ -305,28 +286,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
context 'recheck enforced' do
subject { described_class.new(merge_request).execute(recheck: true) }
context 'when MR is mergeable and merge-ref auto-sync is disabled' do
before do
stub_feature_flags(merge_ref_auto_sync: false)
merge_request.mark_as_mergeable!
end
it 'returns ServiceResponse.error' do
result = subject
expect(result).to be_a(ServiceResponse)
expect(result.error?).to be(true)
expect(result.message).to eq('Merge ref is outdated due to disabled feature')
expect(result.payload).to be_empty
end
it 'merge status is not changed' do
subject
expect(merge_request.merge_status).to eq('can_be_merged')
end
end
context 'when MR is marked as mergeable, but repo is not mergeable and MR is not opened' do
before do
# Making sure that we don't touch the merge-status after
......
......@@ -9,23 +9,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker do
let(:client) { double(:client) }
describe '#import' do
it 'does not import with the feature disabled' do
stub_feature_flags(github_import_pull_request_reviews: false)
expect(Gitlab::JobWaiter)
.to receive(:new)
.and_return(double(key: '123', jobs_remaining: 0))
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
.with(project.id, { '123' => 0 }, :issues_and_diff_notes)
worker.import(client, project)
end
it 'imports all the pull request reviews' do
stub_feature_flags(github_import_pull_request_reviews: true)
importer = double(:importer)
waiter = Gitlab::JobWaiter.new(2, '123')
......
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