Commit d6d6cd7c authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '251017-render-coverage-fuzzing' into 'master'

Pass endpoint for coverage fuzzing to mr widget

See merge request gitlab-org/gitlab!43545
parents 33a3220f 841ee3eb
---
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 { ...@@ -231,14 +231,8 @@ export default {
return this.enabledReports.dast; return this.enabledReports.dast;
}, },
hasCoverageFuzzingReports() { hasCoverageFuzzingReports() {
/* // TODO: Remove feature flag in https://gitlab.com/gitlab-org/gitlab/-/issues/257839
* Fixes bug https://gitlab.com/gitlab-org/gitlab/-/issues/255183 return this.enabledReports.coverageFuzzing && this.glFeatures.coverageFuzzingMrWidget;
* 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
);
}, },
hasSastReports() { hasSastReports() {
return this.enabledReports.sast; return this.enabledReports.sast;
......
...@@ -88,7 +88,7 @@ export default { ...@@ -88,7 +88,7 @@ export default {
}, },
coverageFuzzingPopover() { coverageFuzzingPopover() {
return { return {
title: s__('ciReport|Coverage Fuzzing Title'), title: s__('ciReport|Coverage Fuzzing'),
content: sprintf( content: sprintf(
s__('ciReport|%{linkStartTag}Learn more about Coverage Fuzzing %{linkEndTag}'), s__('ciReport|%{linkStartTag}Learn more about Coverage Fuzzing %{linkEndTag}'),
{ {
......
...@@ -11,6 +11,7 @@ module EE ...@@ -11,6 +11,7 @@ module EE
before_action only: [:show] do before_action only: [:show] do
push_frontend_feature_flag(:anonymous_visual_review_feedback) push_frontend_feature_flag(:anonymous_visual_review_feedback)
push_frontend_feature_flag(:missing_mr_security_scan_types, @project) push_frontend_feature_flag(:missing_mr_security_scan_types, @project)
push_frontend_feature_flag(:coverage_fuzzing_mr_widget, @project)
end end
before_action :whitelist_query_limiting_ee_merge, only: [:merge] before_action :whitelist_query_limiting_ee_merge, only: [:merge]
......
...@@ -20,3 +20,4 @@ ...@@ -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.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.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.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', () => { ...@@ -743,6 +743,14 @@ describe('ee merge request widget options', () => {
describe('Coverage Fuzzing', () => { describe('Coverage Fuzzing', () => {
const COVERAGE_FUZZING_ENDPOINT = 'coverage_fuzzing_report'; const COVERAGE_FUZZING_ENDPOINT = 'coverage_fuzzing_report';
const mountWithFeatureFlag = () =>
new Component({
propsData: { mrData: gl.mrWidgetData },
provide: {
glFeatures: { coverageFuzzingMrWidget: true },
},
}).$mount();
beforeEach(() => { beforeEach(() => {
gl.mrWidgetData = { gl.mrWidgetData = {
...mockData, ...mockData,
...@@ -758,8 +766,7 @@ describe('ee merge request widget options', () => { ...@@ -758,8 +766,7 @@ describe('ee merge request widget options', () => {
it('should render loading indicator', () => { it('should render loading indicator', () => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock); mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
vm = mountWithFeatureFlag();
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
expect( expect(
findSecurityWidget() findSecurityWidget()
...@@ -773,8 +780,7 @@ describe('ee merge request widget options', () => { ...@@ -773,8 +780,7 @@ describe('ee merge request widget options', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock); mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
vm = mountWithFeatureFlag();
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
}); });
it('should render provided data', done => { it('should render provided data', done => {
...@@ -793,8 +799,7 @@ describe('ee merge request widget options', () => { ...@@ -793,8 +799,7 @@ describe('ee merge request widget options', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(500, {}); mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(500, {});
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {}); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {});
vm = mountWithFeatureFlag();
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
}); });
it('should render error indicator', done => { it('should render error indicator', done => {
......
...@@ -63,7 +63,7 @@ describe('Grouped security reports app', () => { ...@@ -63,7 +63,7 @@ describe('Grouped security reports app', () => {
const glModalDirective = jest.fn(); const glModalDirective = jest.fn();
const createWrapper = (propsData, options) => { const createWrapper = (propsData, options, provide) => {
wrapper = mount(GroupedSecurityReportsApp, { wrapper = mount(GroupedSecurityReportsApp, {
propsData, propsData,
data() { data() {
...@@ -80,6 +80,10 @@ describe('Grouped security reports app', () => { ...@@ -80,6 +80,10 @@ describe('Grouped security reports app', () => {
}, },
}, },
store: appStore(), store: appStore(),
provide: {
glFeatures: { coverageFuzzingMrWidget: true },
...provide,
},
}); });
}; };
...@@ -368,6 +372,37 @@ describe('Grouped security reports app', () => { ...@@ -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', () => { describe('container scanning reports', () => {
beforeEach(() => { beforeEach(() => {
gl.mrWidgetData = gl.mrWidgetData || {}; gl.mrWidgetData = gl.mrWidgetData || {};
...@@ -580,40 +615,6 @@ describe('Grouped security reports app', () => { ...@@ -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', () => { describe('Out of date report', () => {
const createComponent = (extraProp, done) => { const createComponent = (extraProp, done) => {
gl.mrWidgetData = gl.mrWidgetData || {}; gl.mrWidgetData = gl.mrWidgetData || {};
......
...@@ -31139,9 +31139,6 @@ msgstr "" ...@@ -31139,9 +31139,6 @@ msgstr ""
msgid "ciReport|Coverage Fuzzing" msgid "ciReport|Coverage Fuzzing"
msgstr "" msgstr ""
msgid "ciReport|Coverage Fuzzing Title"
msgstr ""
msgid "ciReport|Coverage fuzzing" msgid "ciReport|Coverage fuzzing"
msgstr "" 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