Commit 841ee3eb authored by Fernando Arias's avatar Fernando Arias Committed by Brandon Labuschagne

Pass endpoint for coverage fuzzing to mr widget

* Add feature flag for :coverage_fuzzing_mr_widget
* Add unit tests

Attempt to get build green

* Guard with feature flag

Update coverage fuzzing path

* Update to match backend

Remove whitespace to fix pipeline

* Remove to make pipeline green

Update integration MR

- Remove outdated unit tests
- Remove gaurd code for prior bug fix
- Define and use feature flag

Update translation files

* Run rake task

Apply patch suggestion

* Refactor unit tests

Fix bad rebase resolution

- Fix missing conflict resolution
parent f7e50f0b
---
name: coverage_fuzzing_mr_widget
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43545
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/257839
type: development
group: group::fuzz testing
default_enabled: false
......@@ -231,14 +231,8 @@ export default {
return this.enabledReports.dast;
},
hasCoverageFuzzingReports() {
/*
* Fixes bug https://gitlab.com/gitlab-org/gitlab/-/issues/255183
* For https://gitlab.com/gitlab-org/gitlab/-/issues/210343 change to:
* return this.enabledReports.coverageFuzzing;
*/
return (
gl?.mrWidgetData?.coverage_fuzzing_comparison_path && this.enabledReports.coverageFuzzing
);
// TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/257839
return this.enabledReports.coverageFuzzing && this.glFeatures.coverageFuzzingMrWidget;
},
hasSastReports() {
return this.enabledReports.sast;
......
......@@ -88,7 +88,7 @@ export default {
},
coverageFuzzingPopover() {
return {
title: s__('ciReport|Coverage Fuzzing Title'),
title: s__('ciReport|Coverage Fuzzing'),
content: sprintf(
s__('ciReport|%{linkStartTag}Learn more about Coverage Fuzzing %{linkEndTag}'),
{
......
......@@ -11,6 +11,7 @@ module EE
before_action only: [:show] do
push_frontend_feature_flag(:anonymous_visual_review_feedback)
push_frontend_feature_flag(:missing_mr_security_scan_types, @project)
push_frontend_feature_flag(:coverage_fuzzing_mr_widget, @project)
end
before_action :whitelist_query_limiting_ee_merge, only: [:merge]
......
......@@ -20,3 +20,4 @@
window.gl.mrWidgetData.sast_comparison_path = '#{sast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:sast)}'
window.gl.mrWidgetData.dast_comparison_path = '#{dast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:dast)}'
window.gl.mrWidgetData.secret_scanning_comparison_path = '#{secret_detection_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:secret_detection)}'
window.gl.mrWidgetData.coverage_fuzzing_comparison_path = '#{coverage_fuzzing_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:coverage_fuzzing) && Feature.enabled?(:coverage_fuzzing_mr_widget, @project)}'
......@@ -743,6 +743,14 @@ describe('ee merge request widget options', () => {
describe('Coverage Fuzzing', () => {
const COVERAGE_FUZZING_ENDPOINT = 'coverage_fuzzing_report';
const mountWithFeatureFlag = () =>
new Component({
propsData: { mrData: gl.mrWidgetData },
provide: {
glFeatures: { coverageFuzzingMrWidget: true },
},
}).$mount();
beforeEach(() => {
gl.mrWidgetData = {
...mockData,
......@@ -758,8 +766,7 @@ describe('ee merge request widget options', () => {
it('should render loading indicator', () => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
vm = mountWithFeatureFlag();
expect(
findSecurityWidget()
......@@ -773,8 +780,7 @@ describe('ee merge request widget options', () => {
beforeEach(() => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
vm = mountWithFeatureFlag();
});
it('should render provided data', done => {
......@@ -793,8 +799,7 @@ describe('ee merge request widget options', () => {
beforeEach(() => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(500, {});
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {});
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
vm = mountWithFeatureFlag();
});
it('should render error indicator', done => {
......
......@@ -63,7 +63,7 @@ describe('Grouped security reports app', () => {
const glModalDirective = jest.fn();
const createWrapper = (propsData, options) => {
const createWrapper = (propsData, options, provide) => {
wrapper = mount(GroupedSecurityReportsApp, {
propsData,
data() {
......@@ -80,6 +80,10 @@ describe('Grouped security reports app', () => {
},
},
store: appStore(),
provide: {
glFeatures: { coverageFuzzingMrWidget: true },
...provide,
},
});
};
......@@ -368,6 +372,37 @@ describe('Grouped security reports app', () => {
});
});
describe('coverage fuzzing reports', () => {
describe.each([true, false])(
'given coverage fuzzing comparison endpoint is /fuzzing and featureEnabled is %s',
shouldShowFuzzing => {
beforeEach(() => {
gl.mrWidgetData = gl.mrWidgetData || {};
gl.mrWidgetData.coverage_fuzzing_comparison_path = '/fuzzing';
createWrapper(
{
...props,
enabledReports: {
coverageFuzzing: true,
},
},
{},
{
glFeatures: { coverageFuzzingMrWidget: shouldShowFuzzing },
},
);
});
it(`${shouldShowFuzzing ? 'renders' : 'does not render'}`, () => {
expect(wrapper.find('[data-qa-selector="coverage_fuzzing_report"]').exists()).toBe(
shouldShowFuzzing,
);
});
},
);
});
describe('container scanning reports', () => {
beforeEach(() => {
gl.mrWidgetData = gl.mrWidgetData || {};
......@@ -580,40 +615,6 @@ describe('Grouped security reports app', () => {
});
});
describe('coverage fuzzing reports', () => {
/*
* Fixes bug https://gitlab.com/gitlab-org/gitlab/-/issues/255183
* For https://gitlab.com/gitlab-org/gitlab/-/issues/210343
* replace with updated tests
*/
describe.each`
endpoint | shouldShowFuzzing
${'/fuzzing'} | ${true}
${undefined} | ${false}
`(
'given coverage fuzzing comparision enpoint is $endpoint',
({ endpoint, shouldShowFuzzing }) => {
beforeEach(() => {
gl.mrWidgetData = gl.mrWidgetData || {};
gl.mrWidgetData.coverage_fuzzing_comparison_path = endpoint;
createWrapper({
...props,
enabledReports: {
coverageFuzzing: true,
},
});
});
it(`${shouldShowFuzzing ? 'renders' : 'does not render'} security row`, () => {
expect(wrapper.find('[data-qa-selector="coverage_fuzzing_report"]').exists()).toBe(
shouldShowFuzzing,
);
});
},
);
});
describe('Out of date report', () => {
const createComponent = (extraProp, done) => {
gl.mrWidgetData = gl.mrWidgetData || {};
......
......@@ -31121,9 +31121,6 @@ msgstr ""
msgid "ciReport|Coverage Fuzzing"
msgstr ""
msgid "ciReport|Coverage Fuzzing Title"
msgstr ""
msgid "ciReport|Coverage fuzzing"
msgstr ""
......
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