summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/factories
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/alert_management/alerts.rb6
-rw-r--r--spec/factories/analytics/usage_trends/measurement.rb (renamed from spec/factories/analytics/instance_statistics/measurement.rb)2
-rw-r--r--spec/factories/bulk_import/trackers.rb1
-rw-r--r--spec/factories/ci/build_report_results.rb29
-rw-r--r--spec/factories/ci/build_trace_chunks.rb2
-rw-r--r--spec/factories/ci/builds.rb2
-rw-r--r--spec/factories/ci/pipelines.rb8
-rw-r--r--spec/factories/clusters/agent_tokens.rb2
-rw-r--r--spec/factories/custom_emoji.rb1
-rw-r--r--spec/factories/dependency_proxy.rb3
-rw-r--r--spec/factories/design_management/versions.rb5
-rw-r--r--spec/factories/environments.rb18
-rw-r--r--spec/factories/gitlab/database/background_migration/batched_jobs.rb12
-rw-r--r--spec/factories/gitlab/database/background_migration/batched_migrations.rb13
-rw-r--r--spec/factories/go_module_commits.rb10
-rw-r--r--spec/factories/go_module_versions.rb40
-rw-r--r--spec/factories/go_modules.rb2
-rw-r--r--spec/factories/groups.rb32
-rw-r--r--spec/factories/iterations.rb66
-rw-r--r--spec/factories/namespaces.rb40
-rw-r--r--spec/factories/packages.rb9
-rw-r--r--spec/factories/project_repository_storage_moves.rb12
-rw-r--r--spec/factories/projects.rb2
-rw-r--r--spec/factories/prometheus_alert_event.rb5
-rw-r--r--spec/factories/self_managed_prometheus_alert_event.rb11
-rw-r--r--spec/factories/snippet_repository_storage_moves.rb12
26 files changed, 156 insertions, 189 deletions
diff --git a/spec/factories/alert_management/alerts.rb b/spec/factories/alert_management/alerts.rb
index e36e4c38013..ee1225b9542 100644
--- a/spec/factories/alert_management/alerts.rb
+++ b/spec/factories/alert_management/alerts.rb
@@ -47,10 +47,6 @@ FactoryBot.define do
hosts { [FFaker::Internet.ip_v4_address] }
end
- trait :with_ended_at do
- ended_at { Time.current }
- end
-
trait :without_ended_at do
ended_at { nil }
end
@@ -67,7 +63,7 @@ FactoryBot.define do
trait :resolved do
status { AlertManagement::Alert.status_value(:resolved) }
- with_ended_at
+ ended_at { Time.current }
end
trait :ignored do
diff --git a/spec/factories/analytics/instance_statistics/measurement.rb b/spec/factories/analytics/usage_trends/measurement.rb
index f9398cd3061..ec80174e967 100644
--- a/spec/factories/analytics/instance_statistics/measurement.rb
+++ b/spec/factories/analytics/usage_trends/measurement.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
FactoryBot.define do
- factory :instance_statistics_measurement, class: 'Analytics::InstanceStatistics::Measurement' do
+ factory :usage_trends_measurement, class: 'Analytics::UsageTrends::Measurement' do
recorded_at { Time.now }
identifier { :projects }
count { 1_000 }
diff --git a/spec/factories/bulk_import/trackers.rb b/spec/factories/bulk_import/trackers.rb
index 7a1fa0849fc..03af5b41e0f 100644
--- a/spec/factories/bulk_import/trackers.rb
+++ b/spec/factories/bulk_import/trackers.rb
@@ -4,6 +4,7 @@ FactoryBot.define do
factory :bulk_import_tracker, class: 'BulkImports::Tracker' do
association :entity, factory: :bulk_import_entity
+ stage { 0 }
relation { :relation }
has_next_page { false }
end
diff --git a/spec/factories/ci/build_report_results.rb b/spec/factories/ci/build_report_results.rb
index 0685c0e5554..7d716d6d81a 100644
--- a/spec/factories/ci/build_report_results.rb
+++ b/spec/factories/ci/build_report_results.rb
@@ -4,10 +4,15 @@ FactoryBot.define do
factory :ci_build_report_result, class: 'Ci::BuildReportResult' do
build factory: :ci_build
project factory: :project
+
+ transient do
+ test_suite_name { "rspec" }
+ end
+
data do
{
tests: {
- name: "rspec",
+ name: test_suite_name,
duration: 0.42,
failed: 0,
errored: 2,
@@ -21,7 +26,7 @@ FactoryBot.define do
data do
{
tests: {
- name: "rspec",
+ name: test_suite_name,
duration: 0.42,
failed: 0,
errored: 0,
@@ -31,5 +36,25 @@ FactoryBot.define do
}
end
end
+
+ trait :with_junit_suite_error do
+ transient do
+ test_suite_error { "some error" }
+ end
+
+ data do
+ {
+ tests: {
+ name: test_suite_name,
+ duration: 0.42,
+ failed: 0,
+ errored: 0,
+ skipped: 0,
+ success: 2,
+ suite_error: test_suite_error
+ }
+ }
+ end
+ end
end
end
diff --git a/spec/factories/ci/build_trace_chunks.rb b/spec/factories/ci/build_trace_chunks.rb
index d996b41b648..115eb32111c 100644
--- a/spec/factories/ci/build_trace_chunks.rb
+++ b/spec/factories/ci/build_trace_chunks.rb
@@ -3,7 +3,7 @@
FactoryBot.define do
factory :ci_build_trace_chunk, class: 'Ci::BuildTraceChunk' do
build factory: :ci_build
- chunk_index { 0 }
+ chunk_index { generate(:iid) }
data_store { :redis }
trait :redis_with_data do
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index c4f9a4ce82b..886be520668 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -475,7 +475,7 @@ FactoryBot.define do
trait :license_scanning do
options do
{
- artifacts: { reports: { license_management: 'gl-license-scanning-report.json' } }
+ artifacts: { reports: { license_scanning: 'gl-license-scanning-report.json' } }
}
end
end
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index e0d7ad3c133..87b9a6c0e23 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -40,6 +40,10 @@ FactoryBot.define do
end
end
+ trait :created do
+ status { :created }
+ end
+
factory :ci_pipeline do
transient { ci_ref_presence { true } }
@@ -53,10 +57,6 @@ FactoryBot.define do
failure_reason { :config_error }
end
- trait :created do
- status { :created }
- end
-
trait :preparing do
status { :preparing }
end
diff --git a/spec/factories/clusters/agent_tokens.rb b/spec/factories/clusters/agent_tokens.rb
index 6f92f2217b3..c49d197c3cd 100644
--- a/spec/factories/clusters/agent_tokens.rb
+++ b/spec/factories/clusters/agent_tokens.rb
@@ -5,5 +5,7 @@ FactoryBot.define do
association :agent, factory: :cluster_agent
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) }
+
+ sequence(:name) { |n| "agent-token-#{n}" }
end
end
diff --git a/spec/factories/custom_emoji.rb b/spec/factories/custom_emoji.rb
index ba1ae11c18d..88e50eafa7c 100644
--- a/spec/factories/custom_emoji.rb
+++ b/spec/factories/custom_emoji.rb
@@ -6,5 +6,6 @@ FactoryBot.define do
namespace
group
file { 'https://gitlab.com/images/partyparrot.png' }
+ creator { namespace.owner }
end
end
diff --git a/spec/factories/dependency_proxy.rb b/spec/factories/dependency_proxy.rb
index de95df19876..94a7986a8fa 100644
--- a/spec/factories/dependency_proxy.rb
+++ b/spec/factories/dependency_proxy.rb
@@ -10,7 +10,8 @@ FactoryBot.define do
factory :dependency_proxy_manifest, class: 'DependencyProxy::Manifest' do
group
file { fixture_file_upload('spec/fixtures/dependency_proxy/manifest') }
- digest { 'sha256:5ab5a6872b264fe4fd35d63991b9b7d8425f4bc79e7cf4d563c10956581170c9' }
+ digest { 'sha256:d0710affa17fad5f466a70159cc458227bd25d4afb39514ef662ead3e6c99515' }
file_name { 'alpine:latest.json' }
+ content_type { 'application/vnd.docker.distribution.manifest.v2+json' }
end
end
diff --git a/spec/factories/design_management/versions.rb b/spec/factories/design_management/versions.rb
index 0233a3b567d..247a385bd0e 100644
--- a/spec/factories/design_management/versions.rb
+++ b/spec/factories/design_management/versions.rb
@@ -13,11 +13,6 @@ FactoryBot.define do
deleted_designs { [] }
end
- # Warning: this will intentionally result in an invalid version!
- trait :empty do
- designs_count { 0 }
- end
-
trait :importing do
issue { nil }
diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb
index 050cb8f8e6c..072a5f1f402 100644
--- a/spec/factories/environments.rb
+++ b/spec/factories/environments.rb
@@ -15,7 +15,25 @@ FactoryBot.define do
state { :stopped }
end
+ trait :production do
+ tier { :production }
+ end
+
+ trait :staging do
+ tier { :staging }
+ end
+
+ trait :testing do
+ tier { :testing }
+ end
+
+ trait :development do
+ tier { :development }
+ end
+
trait :with_review_app do |environment|
+ sequence(:name) { |n| "review/#{n}" }
+
transient do
ref { 'master' }
end
diff --git a/spec/factories/gitlab/database/background_migration/batched_jobs.rb b/spec/factories/gitlab/database/background_migration/batched_jobs.rb
new file mode 100644
index 00000000000..52bc04447da
--- /dev/null
+++ b/spec/factories/gitlab/database/background_migration/batched_jobs.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :batched_background_migration_job, class: '::Gitlab::Database::BackgroundMigration::BatchedJob' do
+ batched_migration factory: :batched_background_migration
+
+ min_value { 1 }
+ max_value { 10 }
+ batch_size { 5 }
+ sub_batch_size { 1 }
+ end
+end
diff --git a/spec/factories/gitlab/database/background_migration/batched_migrations.rb b/spec/factories/gitlab/database/background_migration/batched_migrations.rb
new file mode 100644
index 00000000000..b45f6ff037b
--- /dev/null
+++ b/spec/factories/gitlab/database/background_migration/batched_migrations.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :batched_background_migration, class: '::Gitlab::Database::BackgroundMigration::BatchedMigration' do
+ max_value { 10 }
+ batch_size { 5 }
+ sub_batch_size { 1 }
+ interval { 2.minutes }
+ job_class_name { 'CopyColumnUsingBackgroundMigrationJob' }
+ table_name { :events }
+ column_name { :id }
+ end
+end
diff --git a/spec/factories/go_module_commits.rb b/spec/factories/go_module_commits.rb
index e42ef6696d1..514a5559344 100644
--- a/spec/factories/go_module_commits.rb
+++ b/spec/factories/go_module_commits.rb
@@ -7,7 +7,12 @@ FactoryBot.define do
transient do
files { { 'foo.txt' => 'content' } }
message { 'Message' }
+ # rubocop: disable FactoryBot/InlineAssociation
+ # We need a persisted project so we can create commits and tags
+ # in `commit` otherwise linting this factory with `build` strategy
+ # will fail.
project { create(:project, :repository) }
+ # rubocop: enable FactoryBot/InlineAssociation
service do
Files::MultiService.new(
@@ -44,14 +49,13 @@ FactoryBot.define do
trait :files do
transient do
- files { raise ArgumentError.new("files is required") }
message { 'Add files' }
end
end
trait :package do
transient do
- path { raise ArgumentError.new("path is required") }
+ path { 'pkg' }
message { 'Add package' }
files { { "#{path}/b.go" => "package b\nfunc Bye() { println(\"Goodbye world!\") }\n" } }
end
@@ -64,7 +68,7 @@ FactoryBot.define do
host_prefix { "#{::Gitlab.config.gitlab.host}/#{project.path_with_namespace}" }
url { name ? "#{host_prefix}/#{name}" : host_prefix }
- path { name.to_s + '/' }
+ path { "#{name}/" }
files do
{
diff --git a/spec/factories/go_module_versions.rb b/spec/factories/go_module_versions.rb
index b0a96197350..145e6c95921 100644
--- a/spec/factories/go_module_versions.rb
+++ b/spec/factories/go_module_versions.rb
@@ -8,12 +8,12 @@ FactoryBot.define do
p = attributes[:params]
s = Packages::SemVer.parse(p.semver, prefixed: true)
- raise ArgumentError.new("invalid sematic version: '#{p.semver}''") if !s && p.semver
+ raise ArgumentError, "invalid sematic version: '#{p.semver}'" if !s && p.semver
new(p.mod, p.type, p.commit, name: p.name, semver: s, ref: p.ref)
end
- mod { create :go_module }
+ mod { association(:go_module) }
type { :commit }
commit { mod.project.repository.head_commit }
name { nil }
@@ -33,45 +33,11 @@ FactoryBot.define do
mod.project.repository.tags
.filter { |t| Packages::SemVer.match?(t.name, prefixed: true) }
.map { |t| Packages::SemVer.parse(t.name, prefixed: true) }
- .max { |a, b| "#{a}" <=> "#{b}" }
+ .max_by(&:to_s)
.to_s
end
params { OpenStruct.new(mod: mod, type: :ref, commit: commit, semver: name, ref: ref) }
end
-
- trait :pseudo do
- transient do
- prefix do
- # This provides a sane default value, but in reality the caller should
- # specify `prefix:`
-
- # This does not take into account that `commit` may be before the
- # latest tag.
-
- # Find 'latest' semver tag (does not actually use semver precedence rules)
- v = mod.project.repository.tags
- .filter { |t| Packages::SemVer.match?(t.name, prefixed: true) }
- .map { |t| Packages::SemVer.parse(t.name, prefixed: true) }
- .max { |a, b| "#{a}" <=> "#{b}" }
-
- # Default if no semver tags exist
- next 'v0.0.0' unless v
-
- # Valid pseudo-versions are:
- # vX.0.0-yyyymmddhhmmss-sha1337beef0, when no earlier tagged commit exists for X
- # vX.Y.Z-pre.0.yyyymmddhhmmss-sha1337beef0, when most recent prior tag is vX.Y.Z-pre
- # vX.Y.(Z+1)-0.yyyymmddhhmmss-sha1337beef0, when most recent prior tag is vX.Y.Z
-
- v = v.with(patch: v.patch + 1) unless v.prerelease
- "#{v}.0"
- end
- end
-
- type { :pseudo }
- name { "#{prefix}#{commit.committed_date.strftime('%Y%m%d%H%M%S')}-#{commit.sha[0..11]}" }
-
- params { OpenStruct.new(mod: mod, type: :pseudo, commit: commit, name: name, semver: name) }
- end
end
end
diff --git a/spec/factories/go_modules.rb b/spec/factories/go_modules.rb
index fdbacf48d3b..ca7184a9194 100644
--- a/spec/factories/go_modules.rb
+++ b/spec/factories/go_modules.rb
@@ -5,7 +5,7 @@ FactoryBot.define do
initialize_with { new(attributes[:project], attributes[:name], attributes[:path]) }
skip_create
- project { create :project, :repository }
+ project { association(:project, :repository) }
path { '' }
name { "#{Settings.build_gitlab_go_url}/#{project.full_path}#{path.empty? ? '' : '/'}#{path}" }
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb
index 17db69e4699..5d232a9d09a 100644
--- a/spec/factories/groups.rb
+++ b/spec/factories/groups.rb
@@ -15,7 +15,7 @@ FactoryBot.define do
raise "Don't set owner for groups, use `group.add_owner(user)` instead"
end
- create(:namespace_settings, namespace: group)
+ create(:namespace_settings, namespace: group) unless group.namespace_settings
end
trait :public do
@@ -61,5 +61,35 @@ FactoryBot.define do
trait :allow_descendants_override_disabled_shared_runners do
allow_descendants_override_disabled_shared_runners { true }
end
+
+ # Construct a hierarchy underneath the group.
+ # Each group will have `children` amount of children,
+ # and `depth` levels of descendants.
+ trait :with_hierarchy do
+ transient do
+ children { 4 }
+ depth { 4 }
+ end
+
+ after(:create) do |group, evaluator|
+ def create_graph(parent: nil, children: 4, depth: 4)
+ return unless depth > 1
+
+ children.times do
+ factory_name = parent.model_name.singular
+ child = FactoryBot.create(factory_name, parent: parent)
+ create_graph(parent: child, children: children, depth: depth - 1)
+ end
+
+ parent
+ end
+
+ create_graph(
+ parent: group,
+ children: evaluator.children,
+ depth: evaluator.depth
+ )
+ end
+ end
end
end
diff --git a/spec/factories/iterations.rb b/spec/factories/iterations.rb
deleted file mode 100644
index bd61cd469af..00000000000
--- a/spec/factories/iterations.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# frozen_string_literal: true
-
-FactoryBot.define do
- sequence(:sequential_date) do |n|
- n.days.from_now
- end
-
- factory :iteration do
- title
- start_date { generate(:sequential_date) }
- due_date { generate(:sequential_date) }
-
- transient do
- project { nil }
- group { nil }
- project_id { nil }
- group_id { nil }
- resource_parent { nil }
- end
-
- trait :upcoming do
- state_enum { Iteration::STATE_ENUM_MAP[:upcoming] }
- end
-
- trait :started do
- state_enum { Iteration::STATE_ENUM_MAP[:started] }
- end
-
- trait :closed do
- state_enum { Iteration::STATE_ENUM_MAP[:closed] }
- end
-
- trait(:skip_future_date_validation) do
- after(:stub, :build) do |iteration|
- iteration.skip_future_date_validation = true
- end
- end
-
- trait(:skip_project_validation) do
- after(:stub, :build) do |iteration|
- iteration.skip_project_validation = true
- end
- end
-
- after(:build, :stub) do |iteration, evaluator|
- if evaluator.group
- iteration.group = evaluator.group
- elsif evaluator.group_id
- iteration.group_id = evaluator.group_id
- elsif evaluator.project
- iteration.project = evaluator.project
- elsif evaluator.project_id
- iteration.project_id = evaluator.project_id
- elsif evaluator.resource_parent
- id = evaluator.resource_parent.id
- evaluator.resource_parent.is_a?(Group) ? evaluator.group_id = id : evaluator.project_id = id
- else
- iteration.group = create(:group)
- end
- end
-
- factory :upcoming_iteration, traits: [:upcoming]
- factory :started_iteration, traits: [:started]
- factory :closed_iteration, traits: [:closed]
- end
-end
diff --git a/spec/factories/namespaces.rb b/spec/factories/namespaces.rb
index 0ec977b8234..f4b57369678 100644
--- a/spec/factories/namespaces.rb
+++ b/spec/factories/namespaces.rb
@@ -23,44 +23,20 @@ FactoryBot.define do
end
trait :with_aggregation_schedule do
- association :aggregation_schedule, factory: :namespace_aggregation_schedules
+ after(:create) do |namespace|
+ create(:namespace_aggregation_schedules, namespace: namespace)
+ end
end
trait :with_root_storage_statistics do
- association :root_storage_statistics, factory: :namespace_root_storage_statistics
+ after(:create) do |namespace|
+ create(:namespace_root_storage_statistics, namespace: namespace)
+ end
end
trait :with_namespace_settings do
- association :namespace_settings, factory: :namespace_settings
- end
-
- # Construct a hierarchy underneath the namespace.
- # Each namespace will have `children` amount of children,
- # and `depth` levels of descendants.
- trait :with_hierarchy do
- transient do
- children { 4 }
- depth { 4 }
- end
-
- after(:create) do |namespace, evaluator|
- def create_graph(parent: nil, children: 4, depth: 4)
- return unless depth > 1
-
- children.times do
- factory_name = parent.model_name.singular
- child = FactoryBot.create(factory_name, parent: parent)
- create_graph(parent: child, children: children, depth: depth - 1)
- end
-
- parent
- end
-
- create_graph(
- parent: namespace,
- children: evaluator.children,
- depth: evaluator.depth
- )
+ after(:create) do |namespace|
+ create(:namespace_settings, namespace: namespace)
end
end
diff --git a/spec/factories/packages.rb b/spec/factories/packages.rb
index 2c64abefb01..882bac1daa9 100644
--- a/spec/factories/packages.rb
+++ b/spec/factories/packages.rb
@@ -277,6 +277,10 @@ FactoryBot.define do
factory :packages_dependency, class: 'Packages::Dependency' do
sequence(:name) { |n| "@test/package-#{n}"}
sequence(:version_pattern) { |n| "~6.2.#{n}" }
+
+ trait(:rubygems) do
+ sequence(:name) { |n| "gem-dependency-#{n}"}
+ end
end
factory :packages_dependency_link, class: 'Packages::DependencyLink' do
@@ -289,6 +293,11 @@ FactoryBot.define do
link.nuget_metadatum = build(:nuget_dependency_link_metadatum)
end
end
+
+ trait(:rubygems) do
+ package { association(:rubygems_package) }
+ dependency { association(:packages_dependency, :rubygems) }
+ end
end
factory :nuget_dependency_link_metadatum, class: 'Packages::Nuget::DependencyLinkMetadatum' do
diff --git a/spec/factories/project_repository_storage_moves.rb b/spec/factories/project_repository_storage_moves.rb
index 5df2b7c32d6..018b6cde32b 100644
--- a/spec/factories/project_repository_storage_moves.rb
+++ b/spec/factories/project_repository_storage_moves.rb
@@ -1,29 +1,29 @@
# frozen_string_literal: true
FactoryBot.define do
- factory :project_repository_storage_move, class: 'ProjectRepositoryStorageMove' do
+ factory :project_repository_storage_move, class: 'Projects::RepositoryStorageMove' do
container { association(:project) }
source_storage_name { 'default' }
trait :scheduled do
- state { ProjectRepositoryStorageMove.state_machines[:state].states[:scheduled].value }
+ state { Projects::RepositoryStorageMove.state_machines[:state].states[:scheduled].value }
end
trait :started do
- state { ProjectRepositoryStorageMove.state_machines[:state].states[:started].value }
+ state { Projects::RepositoryStorageMove.state_machines[:state].states[:started].value }
end
trait :replicated do
- state { ProjectRepositoryStorageMove.state_machines[:state].states[:replicated].value }
+ state { Projects::RepositoryStorageMove.state_machines[:state].states[:replicated].value }
end
trait :finished do
- state { ProjectRepositoryStorageMove.state_machines[:state].states[:finished].value }
+ state { Projects::RepositoryStorageMove.state_machines[:state].states[:finished].value }
end
trait :failed do
- state { ProjectRepositoryStorageMove.state_machines[:state].states[:failed].value }
+ state { Projects::RepositoryStorageMove.state_machines[:state].states[:failed].value }
end
end
end
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index e8e0362fc62..80392a2fece 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -194,7 +194,7 @@ FactoryBot.define do
filename,
content,
message: "Automatically created file #{filename}",
- branch_name: 'master'
+ branch_name: project.default_branch_or_master
)
end
end
diff --git a/spec/factories/prometheus_alert_event.rb b/spec/factories/prometheus_alert_event.rb
index 281fbacabe2..7771a8d5cb7 100644
--- a/spec/factories/prometheus_alert_event.rb
+++ b/spec/factories/prometheus_alert_event.rb
@@ -13,10 +13,5 @@ FactoryBot.define do
ended_at { Time.now }
payload_key { nil }
end
-
- trait :none do
- status { nil }
- started_at { nil }
- end
end
end
diff --git a/spec/factories/self_managed_prometheus_alert_event.rb b/spec/factories/self_managed_prometheus_alert_event.rb
index 238942e2c46..3a48aba5f54 100644
--- a/spec/factories/self_managed_prometheus_alert_event.rb
+++ b/spec/factories/self_managed_prometheus_alert_event.rb
@@ -8,16 +8,5 @@ FactoryBot.define do
title { 'alert' }
query_expression { 'vector(2)' }
started_at { Time.now }
-
- trait :resolved do
- status { SelfManagedPrometheusAlertEvent.status_value_for(:resolved) }
- ended_at { Time.now }
- payload_key { nil }
- end
-
- trait :none do
- status { nil }
- started_at { nil }
- end
end
end
diff --git a/spec/factories/snippet_repository_storage_moves.rb b/spec/factories/snippet_repository_storage_moves.rb
index ed65dc5374f..dd82ec5cfcb 100644
--- a/spec/factories/snippet_repository_storage_moves.rb
+++ b/spec/factories/snippet_repository_storage_moves.rb
@@ -1,29 +1,29 @@
# frozen_string_literal: true
FactoryBot.define do
- factory :snippet_repository_storage_move, class: 'SnippetRepositoryStorageMove' do
+ factory :snippet_repository_storage_move, class: 'Snippets::RepositoryStorageMove' do
container { association(:snippet) }
source_storage_name { 'default' }
trait :scheduled do
- state { SnippetRepositoryStorageMove.state_machines[:state].states[:scheduled].value }
+ state { Snippets::RepositoryStorageMove.state_machines[:state].states[:scheduled].value }
end
trait :started do
- state { SnippetRepositoryStorageMove.state_machines[:state].states[:started].value }
+ state { Snippets::RepositoryStorageMove.state_machines[:state].states[:started].value }
end
trait :replicated do
- state { SnippetRepositoryStorageMove.state_machines[:state].states[:replicated].value }
+ state { Snippets::RepositoryStorageMove.state_machines[:state].states[:replicated].value }
end
trait :finished do
- state { SnippetRepositoryStorageMove.state_machines[:state].states[:finished].value }
+ state { Snippets::RepositoryStorageMove.state_machines[:state].states[:finished].value }
end
trait :failed do
- state { SnippetRepositoryStorageMove.state_machines[:state].states[:failed].value }
+ state { Snippets::RepositoryStorageMove.state_machines[:state].states[:failed].value }
end
end
end