summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 15:09:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 15:09:45 +0000
commitaaf59610548d9b0fd01acfd50e831cbe519ecba2 (patch)
treeb6505abedcd965ebae5118b504b185b63129dc4c /spec/factories
parent1363ca12f1f07c634647cf55c4c16b7401098673 (diff)
downloadgitlab-ce-aaf59610548d9b0fd01acfd50e831cbe519ecba2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/usage_data.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/factories/usage_data.rb b/spec/factories/usage_data.rb
new file mode 100644
index 00000000000..9560e076ae4
--- /dev/null
+++ b/spec/factories/usage_data.rb
@@ -0,0 +1,64 @@
+# 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
+ projects = create_list(:project, 4)
+ create(:board, project: projects[0])
+ create(:jira_service, project: projects[0])
+ create(:jira_service, :without_properties_callback, project: projects[1])
+ create(:jira_service, :jira_cloud_service, project: projects[2])
+ create(:jira_service, :without_properties_callback, project: projects[3],
+ properties: { url: 'https://mysite.atlassian.net' })
+ create(:prometheus_service, project: projects[1])
+ create(:service, project: projects[0], type: 'SlackSlashCommandsService', active: true)
+ create(:service, project: projects[1], type: 'SlackService', active: true)
+ create(:service, project: projects[2], type: 'SlackService', active: true)
+ create(:service, project: projects[2], type: 'MattermostService', active: false)
+ create(:service, :template, type: 'MattermostService', active: true)
+ create(:service, project: projects[2], type: 'CustomIssueTrackerService', active: true)
+ create(:project_error_tracking_setting, project: projects[0])
+ create(:project_error_tracking_setting, project: projects[1], enabled: false)
+ create(:alerts_service, project: projects[0])
+ create(:alerts_service, :inactive, project: projects[1])
+ create_list(:issue, 2, project: projects[0], author: User.alert_bot)
+ create_list(:issue, 2, project: projects[1], author: User.alert_bot)
+ create_list(:issue, 4, project: projects[0])
+ 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])
+
+ # Enabled clusters
+ gcp_cluster = create(:cluster_provider_gcp, :created).cluster
+ create(:cluster_provider_aws, :created)
+ create(:cluster_platform_kubernetes)
+ create(:cluster, :group)
+
+ # Disabled clusters
+ create(:cluster, :disabled)
+ create(:cluster, :group, :disabled)
+ create(:cluster, :group, :disabled)
+
+ # Applications
+ create(:clusters_applications_helm, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_ingress, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_cert_manager, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_prometheus, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_crossplane, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_runner, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_knative, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_elastic_stack, :installed, cluster: gcp_cluster)
+ create(:clusters_applications_jupyter, :installed, cluster: gcp_cluster)
+
+ create(:grafana_integration, project: projects[0], enabled: true)
+ create(:grafana_integration, project: projects[1], enabled: true)
+ create(:grafana_integration, project: projects[2], enabled: false)
+
+ ProjectFeature.first.update_attribute('repository_access_level', 0)
+ end
+ end
+end