2020-03-18 11:09:45 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :usage_data, class: 'Gitlab::UsageData' do
|
|
|
|
skip_create # non-model factories (i.e. without #save)
|
|
|
|
|
|
|
|
initialize_with do
|
2022-02-21 22:14:19 -05:00
|
|
|
projects = create_list(:project, 4, :repository)
|
2020-10-16 08:09:33 -04:00
|
|
|
group = create(:group)
|
2020-03-18 11:09:45 -04:00
|
|
|
create(:board, project: projects[0])
|
2021-06-18 11:10:16 -04:00
|
|
|
create(:jira_integration, project: projects[0])
|
|
|
|
create(:jira_integration, :without_properties_callback, project: projects[1])
|
|
|
|
create(:jira_integration, :jira_cloud_service, project: projects[2])
|
|
|
|
create(:jira_integration, :without_properties_callback, project: projects[3], properties: { url: 'https://mysite.atlassian.net' })
|
2020-04-30 02:10:03 -04:00
|
|
|
jira_label = create(:label, project: projects[0])
|
|
|
|
create(:jira_import_state, :finished, project: projects[0], label: jira_label, failed_to_import_count: 2, imported_issues_count: 7, total_issue_count: 9)
|
|
|
|
create(:jira_import_state, :finished, project: projects[1], label: jira_label, imported_issues_count: 3, total_issue_count: 3)
|
|
|
|
create(:jira_import_state, :finished, project: projects[1], label: jira_label, imported_issues_count: 3)
|
|
|
|
create(:jira_import_state, :scheduled, project: projects[1], label: jira_label)
|
2021-06-18 17:10:06 -04:00
|
|
|
create(:prometheus_integration, project: projects[1])
|
2022-02-21 22:14:19 -05:00
|
|
|
create(:jenkins_integration, project: projects[1])
|
|
|
|
|
|
|
|
# slack
|
|
|
|
create(:slack_slash_commands_integration, project: projects[0])
|
|
|
|
create(:integrations_slack, project: projects[1])
|
|
|
|
create(:integrations_slack, project: projects[2])
|
|
|
|
|
|
|
|
# mattermost
|
|
|
|
create(:mattermost_integration, project: projects[2], active: false)
|
|
|
|
create(:mattermost_integration, group: group, project: nil)
|
|
|
|
mattermost_instance = create(:mattermost_integration, :instance)
|
|
|
|
create(:mattermost_integration, project: projects[1], inherit_from_id: mattermost_instance.id)
|
|
|
|
create(:integrations_slack, group: group, project: nil, active: true, inherit_from_id: mattermost_instance.id)
|
|
|
|
|
|
|
|
create(:custom_issue_tracker_integration, project: projects[2], active: true)
|
2020-03-18 11:09:45 -04:00
|
|
|
create(:project_error_tracking_setting, project: projects[0])
|
|
|
|
create(:project_error_tracking_setting, project: projects[1], enabled: false)
|
2020-08-12 02:09:53 -04:00
|
|
|
alert_bot_issues = create_list(:incident, 2, project: projects[0], author: User.alert_bot)
|
|
|
|
create_list(:incident, 2, project: projects[1], author: User.alert_bot)
|
2020-05-15 14:07:52 -04:00
|
|
|
issues = create_list(:issue, 4, project: projects[0])
|
|
|
|
create_list(:prometheus_alert, 2, project: projects[0])
|
2020-04-01 20:08:11 -04:00
|
|
|
create(:prometheus_alert, project: projects[1])
|
2020-05-20 20:08:06 -04:00
|
|
|
create(:merge_request, :simple, :with_terraform_reports, source_project: projects[0])
|
|
|
|
create(:merge_request, :rebased, :with_terraform_reports, source_project: projects[0])
|
|
|
|
create(:merge_request, :simple, :with_terraform_reports, source_project: projects[1])
|
2020-05-20 23:08:00 -04:00
|
|
|
create(:terraform_state, project: projects[0])
|
|
|
|
create(:terraform_state, project: projects[0])
|
|
|
|
create(:terraform_state, project: projects[1])
|
2020-03-18 11:09:45 -04:00
|
|
|
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0], issue_status: :added)
|
|
|
|
create_list(:zoom_meeting, 2, project: projects[0], issue: projects[0].issues[1], issue_status: :removed)
|
|
|
|
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :added)
|
|
|
|
create_list(:zoom_meeting, 2, project: projects[0], issue: projects[0].issues[2], issue_status: :removed)
|
|
|
|
create(:sentry_issue, issue: projects[0].issues[0])
|
2020-08-07 17:10:07 -04:00
|
|
|
create(:protected_branch, project: projects[0])
|
|
|
|
create(:protected_branch, name: 'main', project: projects[0])
|
2020-03-18 11:09:45 -04:00
|
|
|
|
2020-11-05 22:09:19 -05:00
|
|
|
# Alert Management
|
|
|
|
create(:alert_management_http_integration, project: projects[0], name: 'DataDog')
|
|
|
|
create(:alert_management_http_integration, project: projects[0], name: 'DataCat')
|
|
|
|
create(:alert_management_http_integration, :inactive, project: projects[1], name: 'DataFox')
|
|
|
|
|
2020-10-02 08:09:03 -04:00
|
|
|
# Tracing
|
|
|
|
create(:project_tracing_setting, project: projects[0])
|
|
|
|
|
2020-05-15 14:07:52 -04:00
|
|
|
# Alert Issues
|
|
|
|
create(:alert_management_alert, issue: issues[0], project: projects[0])
|
|
|
|
create(:alert_management_alert, issue: alert_bot_issues[0], project: projects[0])
|
2020-06-05 20:08:18 -04:00
|
|
|
create(:self_managed_prometheus_alert_event, related_issues: [issues[1]], project: projects[0])
|
2020-05-15 14:07:52 -04:00
|
|
|
|
2020-08-28 14:10:51 -04:00
|
|
|
# Kubernetes agents
|
|
|
|
create(:cluster_agent, project: projects[0])
|
2020-09-01 02:10:44 -04:00
|
|
|
create(:cluster_agent_token, agent: create(:cluster_agent, project: projects[1]) )
|
2020-08-28 14:10:51 -04:00
|
|
|
|
2020-03-18 11:09:45 -04:00
|
|
|
# Enabled clusters
|
|
|
|
gcp_cluster = create(:cluster_provider_gcp, :created).cluster
|
|
|
|
create(:cluster_provider_aws, :created)
|
|
|
|
create(:cluster_platform_kubernetes)
|
2020-04-09 14:09:34 -04:00
|
|
|
create(:cluster, :management_project, management_project: projects[0])
|
2020-03-18 11:09:45 -04:00
|
|
|
create(:cluster, :group)
|
2020-04-09 14:09:34 -04:00
|
|
|
create(:cluster, :instance, :production_environment)
|
2020-03-18 11:09:45 -04:00
|
|
|
|
|
|
|
# Disabled clusters
|
|
|
|
create(:cluster, :disabled)
|
|
|
|
create(:cluster, :group, :disabled)
|
2020-04-09 14:09:34 -04:00
|
|
|
create(:cluster, :instance, :disabled)
|
2020-03-18 11:09:45 -04:00
|
|
|
|
2021-10-06 11:11:48 -04:00
|
|
|
# Cluster Integrations
|
|
|
|
create(:clusters_integrations_prometheus, cluster: gcp_cluster)
|
|
|
|
create(:clusters_integrations_elastic_stack, cluster: gcp_cluster)
|
2020-03-18 11:09:45 -04:00
|
|
|
|
|
|
|
create(:grafana_integration, project: projects[0], enabled: true)
|
|
|
|
create(:grafana_integration, project: projects[1], enabled: true)
|
|
|
|
create(:grafana_integration, project: projects[2], enabled: false)
|
|
|
|
|
2020-09-28 08:10:02 -04:00
|
|
|
create(:package, project: projects[0], created_at: 3.days.ago)
|
|
|
|
create(:package, project: projects[0], created_at: 3.days.ago)
|
|
|
|
create(:package, project: projects[1], created_at: 3.days.ago)
|
2020-09-04 11:08:46 -04:00
|
|
|
create(:package, created_at: 2.months.ago, project: projects[1])
|
2020-08-24 05:10:14 -04:00
|
|
|
|
2020-09-23 08:09:58 -04:00
|
|
|
# User Preferences
|
|
|
|
create(:user_preference, gitpod_enabled: true)
|
|
|
|
|
2020-03-18 11:09:45 -04:00
|
|
|
ProjectFeature.first.update_attribute('repository_access_level', 0)
|
2020-06-23 02:08:52 -04:00
|
|
|
|
|
|
|
# Create fresh & a month (28-days SMAU) old data
|
2020-07-03 08:08:53 -04:00
|
|
|
env = create(:environment, project: projects[3])
|
2020-09-28 08:10:02 -04:00
|
|
|
[3, 31].each do |n|
|
2020-07-03 08:08:53 -04:00
|
|
|
deployment_options = { created_at: n.days.ago, project: env.project, environment: env }
|
2021-02-05 10:09:28 -05:00
|
|
|
create(:deployment, :failed, **deployment_options)
|
|
|
|
create(:deployment, :success, **deployment_options)
|
2020-06-24 14:09:03 -04:00
|
|
|
create_list(:project_snippet, 2, project: projects[0], created_at: n.days.ago)
|
|
|
|
create(:personal_snippet, created_at: n.days.ago)
|
2020-06-23 02:08:52 -04:00
|
|
|
end
|
2021-08-10 08:11:00 -04:00
|
|
|
|
|
|
|
create(:operations_feature_flag, project: projects[0])
|
2020-03-18 11:09:45 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|