Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/gitlab/database')
-rw-r--r--spec/factories/gitlab/database/postgres_index.rb19
-rw-r--r--spec/factories/gitlab/database/postgres_index_bloat_estimate.rb10
-rw-r--r--spec/factories/gitlab/database/reindexing/reindex_action.rb14
3 files changed, 43 insertions, 0 deletions
diff --git a/spec/factories/gitlab/database/postgres_index.rb b/spec/factories/gitlab/database/postgres_index.rb
new file mode 100644
index 00000000000..54bbb738512
--- /dev/null
+++ b/spec/factories/gitlab/database/postgres_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :postgres_index, class: 'Gitlab::Database::PostgresIndex' do
+ identifier { "public.some_index_#{indexrelid}" }
+ sequence(:indexrelid) { |n| n }
+ schema { 'public' }
+ name { "some_index_#{indexrelid}" }
+ tablename { 'foo' }
+ unique { false }
+ valid_index { true }
+ partitioned { false }
+ exclusion { false }
+ expression { false }
+ partial { false }
+ definition { "CREATE INDEX #{identifier} ON #{tablename} (bar)"}
+ ondisk_size_bytes { 100.megabytes }
+ end
+end
diff --git a/spec/factories/gitlab/database/postgres_index_bloat_estimate.rb b/spec/factories/gitlab/database/postgres_index_bloat_estimate.rb
new file mode 100644
index 00000000000..878650714b8
--- /dev/null
+++ b/spec/factories/gitlab/database/postgres_index_bloat_estimate.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :postgres_index_bloat_estimate, class: 'Gitlab::Database::PostgresIndexBloatEstimate' do
+ association :index, factory: :postgres_index
+
+ identifier { index.identifier }
+ bloat_size_bytes { 10.megabytes }
+ end
+end
diff --git a/spec/factories/gitlab/database/reindexing/reindex_action.rb b/spec/factories/gitlab/database/reindexing/reindex_action.rb
new file mode 100644
index 00000000000..4b558286463
--- /dev/null
+++ b/spec/factories/gitlab/database/reindexing/reindex_action.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :reindex_action, class: 'Gitlab::Database::Reindexing::ReindexAction' do
+ association :index, factory: :postgres_index
+
+ action_start { Time.now - 10.minutes }
+ action_end { Time.now - 5.minutes }
+ ondisk_size_bytes_start { 2.megabytes }
+ ondisk_size_bytes_end { 1.megabytes }
+ state { Gitlab::Database::Reindexing::ReindexAction.states[:finished] }
+ index_identifier { index.identifier }
+ end
+end