Commit e20ad592 authored by James Lopez's avatar James Lopez

Merge branch '330389-add-coverage-fuzzing-to-devops-adoption-api' into 'master'

Add Coverage fuzzing to DevopsAdoption API

See merge request gitlab-org/gitlab!65253
parents 89bf35c4 f1d4e0c5
# frozen_string_literal: true
class AddDevopsAdoptionCoverageFuzzing < ActiveRecord::Migration[6.1]
def change
add_column :analytics_devops_adoption_snapshots, :coverage_fuzzing_enabled_count, :integer
end
end
2fca5d3203b7bb766274fc333e9a2a267340142856bd23efaabb1cb2c1cb7cb7
\ No newline at end of file
......@@ -9138,6 +9138,7 @@ CREATE TABLE analytics_devops_adoption_snapshots (
sast_enabled_count integer,
dast_enabled_count integer,
dependency_scanning_enabled_count integer,
coverage_fuzzing_enabled_count integer,
CONSTRAINT check_3f472de131 CHECK ((namespace_id IS NOT NULL))
);
......@@ -8506,6 +8506,7 @@ Snapshot.
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="devopsadoptionsnapshotcodeownersusedcount"></a>`codeOwnersUsedCount` | [`Int`](#int) | Total number of projects with existing CODEOWNERS file. |
| <a id="devopsadoptionsnapshotcoveragefuzzingenabledcount"></a>`coverageFuzzingEnabledCount` | [`Int`](#int) | Total number of projects with enabled coverage fuzzing. |
| <a id="devopsadoptionsnapshotdastenabledcount"></a>`dastEnabledCount` | [`Int`](#int) | Total number of projects with enabled DAST. |
| <a id="devopsadoptionsnapshotdependencyscanningenabledcount"></a>`dependencyScanningEnabledCount` | [`Int`](#int) | Total number of projects with enabled dependency scanning. |
| <a id="devopsadoptionsnapshotdeploysucceeded"></a>`deploySucceeded` | [`Boolean!`](#boolean) | At least one deployment succeeded. |
......
......@@ -30,6 +30,8 @@ module Types
description: 'Total number of projects with enabled DAST.'
field :dependency_scanning_enabled_count, GraphQL::INT_TYPE, null: true,
description: 'Total number of projects with enabled dependency scanning.'
field :coverage_fuzzing_enabled_count, GraphQL::INT_TYPE, null: true,
description: 'Total number of projects with enabled coverage fuzzing.'
field :total_projects_count, GraphQL::INT_TYPE, null: true,
description: 'Total number of projects.'
field :recorded_at, Types::TimeType, null: false,
......
......@@ -18,6 +18,7 @@ class Analytics::DevopsAdoption::Snapshot < ApplicationRecord
:sast_enabled_count,
:dast_enabled_count,
:dependency_scanning_enabled_count,
:coverage_fuzzing_enabled_count,
:total_projects_count
].freeze
......
......@@ -113,6 +113,10 @@ module Analytics
projects_count_with_artifact(Ci::JobArtifact.dependency_list_reports)
end
def coverage_fuzzing_enabled_count
projects_count_with_artifact(Ci::JobArtifact.coverage_fuzzing_reports)
end
# rubocop: disable CodeReuse/ActiveRecord
def projects_count_with_artifact(artifacts_scope)
subquery = artifacts_scope.created_in_time_range(from: range_start, to: range_end)
......
......@@ -197,6 +197,12 @@ RSpec.describe Analytics::DevopsAdoption::SnapshotCalculator do
include_examples 'calculates artifact type count', :dependency_scanning
end
describe 'coverage_fuzzing_enabled_count' do
subject { data[:coverage_fuzzing_enabled_count] }
include_examples 'calculates artifact type count', :coverage_fuzzing
end
context 'when snapshot already exists' do
subject(:data) { described_class.new(enabled_namespace: enabled_namespace, range_end: range_end, snapshot: snapshot).calculate }
......
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