summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 19:00:14 +0000
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/factories
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
downloadgitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/abuse_reports.rb1
-rw-r--r--spec/factories/analytics/cycle_analytics/aggregations.rb2
-rw-r--r--spec/factories/appearances.rb4
-rw-r--r--spec/factories/bulk_import/entities.rb1
-rw-r--r--spec/factories/ci/builds.rb14
-rw-r--r--spec/factories/ci/job_artifacts.rb8
-rw-r--r--spec/factories/ci/runner_machines.rb8
-rw-r--r--spec/factories/design_management/designs.rb5
-rw-r--r--spec/factories/groups.rb2
-rw-r--r--spec/factories/integrations.rb10
-rw-r--r--spec/factories/ml/candidates.rb9
-rw-r--r--spec/factories/personal_access_tokens.rb6
-rw-r--r--spec/factories/projects/build_artifacts_size_refreshes.rb4
-rw-r--r--spec/factories/wiki_pages.rb2
14 files changed, 69 insertions, 7 deletions
diff --git a/spec/factories/abuse_reports.rb b/spec/factories/abuse_reports.rb
index 4174faae1ed..4ae9b4def8e 100644
--- a/spec/factories/abuse_reports.rb
+++ b/spec/factories/abuse_reports.rb
@@ -5,5 +5,6 @@ FactoryBot.define do
reporter factory: :user
user
message { 'User sends spam' }
+ reported_from_url { 'http://gitlab.com' }
end
end
diff --git a/spec/factories/analytics/cycle_analytics/aggregations.rb b/spec/factories/analytics/cycle_analytics/aggregations.rb
index 78e82f166d0..99f0e34ede7 100644
--- a/spec/factories/analytics/cycle_analytics/aggregations.rb
+++ b/spec/factories/analytics/cycle_analytics/aggregations.rb
@@ -2,7 +2,7 @@
FactoryBot.define do
factory :cycle_analytics_aggregation, class: 'Analytics::CycleAnalytics::Aggregation' do
- group
+ namespace { association(:group) }
enabled { true }
diff --git a/spec/factories/appearances.rb b/spec/factories/appearances.rb
index 8101cd8d8bf..321c31d7565 100644
--- a/spec/factories/appearances.rb
+++ b/spec/factories/appearances.rb
@@ -18,6 +18,10 @@ FactoryBot.define do
header_logo { fixture_file_upload('spec/fixtures/dk.png') }
end
+ trait :with_pwa_icon do
+ pwa_icon { fixture_file_upload('spec/fixtures/dk.png') }
+ end
+
trait :with_favicon do
favicon { fixture_file_upload('spec/fixtures/dk.png') }
end
diff --git a/spec/factories/bulk_import/entities.rb b/spec/factories/bulk_import/entities.rb
index eeb4f8325ae..66d212daaae 100644
--- a/spec/factories/bulk_import/entities.rb
+++ b/spec/factories/bulk_import/entities.rb
@@ -10,6 +10,7 @@ FactoryBot.define do
sequence(:destination_namespace) { |n| "destination-path-#{n}" }
destination_name { 'Imported Entity' }
sequence(:source_xid)
+ migrate_projects { true }
trait(:group_entity) do
source_type { :group_entity }
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index 15a88955e05..78398fd7f20 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -421,9 +421,17 @@ FactoryBot.define do
end
trait :artifacts do
- after(:create) do |build|
- create(:ci_job_artifact, :archive, job: build, expire_at: build.artifacts_expire_at)
- create(:ci_job_artifact, :metadata, job: build, expire_at: build.artifacts_expire_at)
+ after(:create) do |build, evaluator|
+ create(:ci_job_artifact, :archive, :public, job: build, expire_at: build.artifacts_expire_at)
+ create(:ci_job_artifact, :metadata, :public, job: build, expire_at: build.artifacts_expire_at)
+ build.reload
+ end
+ end
+
+ trait :private_artifacts do
+ after(:create) do |build, evaluator|
+ create(:ci_job_artifact, :archive, :private, job: build, expire_at: build.artifacts_expire_at)
+ create(:ci_job_artifact, :metadata, :private, job: build, expire_at: build.artifacts_expire_at)
build.reload
end
end
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index 7569e832c60..5e049e0375b 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -174,6 +174,14 @@ FactoryBot.define do
end
end
+ trait :private do
+ accessibility { 'private' }
+ end
+
+ trait :public do
+ accessibility { 'public' }
+ end
+
trait :accessibility do
file_type { :accessibility }
file_format { :raw }
diff --git a/spec/factories/ci/runner_machines.rb b/spec/factories/ci/runner_machines.rb
new file mode 100644
index 00000000000..09bf5d0844e
--- /dev/null
+++ b/spec/factories/ci/runner_machines.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_runner_machine, class: 'Ci::RunnerMachine' do
+ runner factory: :ci_runner
+ machine_xid { "r_#{SecureRandom.hex.slice(0, 10)}" }
+ end
+end
diff --git a/spec/factories/design_management/designs.rb b/spec/factories/design_management/designs.rb
index 3d95c754a96..d16fd0c297b 100644
--- a/spec/factories/design_management/designs.rb
+++ b/spec/factories/design_management/designs.rb
@@ -100,8 +100,9 @@ FactoryBot.define do
trait :with_file do
transient do
deleted { false }
- versions_count { 1 }
file { File.join(Rails.root, 'spec/fixtures/dk.png') }
+ versions_count { 1 }
+ versions_sha { nil }
end
after :create do |design, evaluator|
@@ -109,6 +110,8 @@ FactoryBot.define do
repository = project.design_repository
commit_version = ->(action) do
+ return evaluator.versions_sha if evaluator.versions_sha
+
repository.commit_files(
evaluator.author,
branch_name: 'master',
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb
index f4d47b9ff8c..5b4839df2d3 100644
--- a/spec/factories/groups.rb
+++ b/spec/factories/groups.rb
@@ -74,7 +74,7 @@ FactoryBot.define do
allow_descendants_override_disabled_shared_runners { false }
end
- trait :disabled_with_override do
+ trait :disabled_and_overridable do
shared_runners_disabled
allow_descendants_override_disabled_shared_runners
end
diff --git a/spec/factories/integrations.rb b/spec/factories/integrations.rb
index ebbf1b560e5..7740b2da911 100644
--- a/spec/factories/integrations.rb
+++ b/spec/factories/integrations.rb
@@ -254,6 +254,16 @@ FactoryBot.define do
password { 'harborpassword' }
end
+ factory :apple_app_store_integration, class: 'Integrations::AppleAppStore' do
+ project
+ active { true }
+ type { 'Integrations::AppleAppStore' }
+
+ app_store_issuer_id { 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' }
+ app_store_key_id { 'ABC1' }
+ app_store_private_key { File.read('spec/fixtures/ssl_key.pem') }
+ end
+
# this is for testing storing values inside properties, which is deprecated and will be removed in
# https://gitlab.com/gitlab-org/gitlab/issues/29404
trait :without_properties_callback do
diff --git a/spec/factories/ml/candidates.rb b/spec/factories/ml/candidates.rb
index 2daed36d777..1b41e39d711 100644
--- a/spec/factories/ml/candidates.rb
+++ b/spec/factories/ml/candidates.rb
@@ -16,5 +16,14 @@ FactoryBot.define do
candidate.metadata = FactoryBot.create_list(:ml_candidate_metadata, 2, candidate: candidate )
end
end
+
+ trait :with_artifact do
+ after(:create) do |candidate|
+ FactoryBot.create(:generic_package,
+ name: candidate.package_name,
+ version: candidate.package_version,
+ project: candidate.project)
+ end
+ end
end
end
diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb
index 9625fdc195d..a140011941f 100644
--- a/spec/factories/personal_access_tokens.rb
+++ b/spec/factories/personal_access_tokens.rb
@@ -27,6 +27,12 @@ FactoryBot.define do
token_digest { nil }
end
+ trait :admin_mode do
+ before(:create) do |personal_access_token|
+ personal_access_token.scopes.append(Gitlab::Auth::ADMIN_MODE_SCOPE) if personal_access_token.user.admin?
+ end
+ end
+
trait :no_prefix do
after(:build) { |personal_access_token| personal_access_token.set_token(Devise.friendly_token) }
end
diff --git a/spec/factories/projects/build_artifacts_size_refreshes.rb b/spec/factories/projects/build_artifacts_size_refreshes.rb
index b05f5dfab1c..b00cecfa705 100644
--- a/spec/factories/projects/build_artifacts_size_refreshes.rb
+++ b/spec/factories/projects/build_artifacts_size_refreshes.rb
@@ -18,6 +18,10 @@ FactoryBot.define do
refresh_started_at { Time.zone.now }
end
+ trait :finalizing do
+ state { Projects::BuildArtifactsSizeRefresh::STATES[:finalizing] }
+ end
+
trait :stale do
running
refresh_started_at { 30.days.ago }
diff --git a/spec/factories/wiki_pages.rb b/spec/factories/wiki_pages.rb
index 6f912a183e8..9b4c8a4fced 100644
--- a/spec/factories/wiki_pages.rb
+++ b/spec/factories/wiki_pages.rb
@@ -28,7 +28,7 @@ FactoryBot.define do
# Clear our default @page, except when using build_stubbed
after(:build) do |page|
- page.instance_variable_set('@page', nil)
+ page.instance_variable_set(:@page, nil)
end
to_create do |page, evaluator|