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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-22 18:10:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-22 18:10:05 +0300
commit4ec96676406da695de083b4f394290902da2a964 (patch)
tree55dddec9b7e2498f800b1851f0778e25997868cd
parentf2d662be68fb15a2b38abaff576693f2b8f2c2f3 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.rubocop_todo/style/open_struct_use.yml1
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.checksum2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/models/application_setting.rb3
-rw-r--r--app/services/ci/runners/stale_managers_cleanup_service.rb17
-rw-r--r--danger/database/Dangerfile2
-rw-r--r--db/migrate/20230517090826_add_namespace_aggregation_schedule_lease_duration_to_application_settings.rb11
-rw-r--r--db/schema_migrations/202305170908261
-rw-r--r--db/structure.sql1
-rw-r--r--doc/ci/resource_groups/index.md2
-rw-r--r--doc/user/analytics/value_streams_dashboard.md7
-rw-r--r--doc/user/group/index.md6
-rw-r--r--doc/user/group/manage.md6
-rw-r--r--lefthook.yml6
-rw-r--r--qa/Gemfile6
-rw-r--r--qa/Gemfile.lock12
-rw-r--r--qa/qa/tools/migrate_influx_data_to_gcs.rb16
-rw-r--r--spec/factories/wiki_pages.rb4
-rw-r--r--spec/models/application_setting_spec.rb2
-rw-r--r--spec/services/ci/runners/stale_managers_cleanup_service_spec.rb21
-rw-r--r--spec/workers/ci/runners/stale_machines_cleanup_cron_worker_spec.rb3
22 files changed, 91 insertions, 44 deletions
diff --git a/.rubocop_todo/style/open_struct_use.yml b/.rubocop_todo/style/open_struct_use.yml
index 15e4539072d..c21b63bc22b 100644
--- a/.rubocop_todo/style/open_struct_use.yml
+++ b/.rubocop_todo/style/open_struct_use.yml
@@ -5,7 +5,6 @@ Style/OpenStructUse:
- 'ee/spec/finders/template_finder_spec.rb'
- 'ee/spec/helpers/ee/blob_helper_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/failure_handler_spec.rb'
- - 'spec/factories/wiki_pages.rb'
- 'spec/helpers/profiles_helper_spec.rb'
- 'spec/lib/gitlab/gitaly_client/blobs_stitcher_spec.rb'
- 'spec/lib/gitlab/gitaly_client/diff_stitcher_spec.rb'
diff --git a/Gemfile b/Gemfile
index eec27dddbc6..44fde83a7c4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -367,7 +367,7 @@ gem 'prometheus-client-mmap', '~> 0.23', require: 'prometheus/client'
gem 'warning', '~> 1.3.0'
group :development do
- gem 'lefthook', '~> 1.3.13', require: false
+ gem 'lefthook', '~> 1.4.0', require: false
gem 'rubocop'
gem 'solargraph', '~> 0.47.2', require: false
diff --git a/Gemfile.checksum b/Gemfile.checksum
index bac1e6990fd..bc127771a51 100644
--- a/Gemfile.checksum
+++ b/Gemfile.checksum
@@ -330,7 +330,7 @@
{"name":"kramdown-parser-gfm","version":"1.1.0","platform":"ruby","checksum":"fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729"},
{"name":"kubeclient","version":"4.11.0","platform":"ruby","checksum":"4985fcd749fb8c364a668a8350a49821647f03aa52d9ee6cbc582beb8e883fcc"},
{"name":"launchy","version":"2.5.0","platform":"ruby","checksum":"954243c4255920982ce682f89a42e76372dba94770bf09c23a523e204bdebef5"},
-{"name":"lefthook","version":"1.3.13","platform":"ruby","checksum":"0f51b9eaa3b9193cf423d8766012df3bd1bc0467c458755ed16779013930df72"},
+{"name":"lefthook","version":"1.4.0","platform":"ruby","checksum":"363e055d4bf985a5409c548f7b0d584ab87902221f6c5b3a5cc3fcfc84a2f356"},
{"name":"letter_opener","version":"1.7.0","platform":"ruby","checksum":"095bc0d58e006e5b43ea7d219e64ecf2de8d1f7d9dafc432040a845cf59b4725"},
{"name":"letter_opener_web","version":"2.0.0","platform":"ruby","checksum":"33860ad41e1785d75456500e8ca8bba8ed71ee6eaf08a98d06bbab67c5577b6f"},
{"name":"libyajl2","version":"1.2.0","platform":"ruby","checksum":"1117cd1e48db013b626e36269bbf1cef210538ca6d2e62d3fa3db9ded005b258"},
diff --git a/Gemfile.lock b/Gemfile.lock
index c804e096235..637738b31e9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -878,7 +878,7 @@ GEM
rest-client (~> 2.0)
launchy (2.5.0)
addressable (~> 2.7)
- lefthook (1.3.13)
+ lefthook (1.4.0)
letter_opener (1.7.0)
launchy (~> 2.2)
letter_opener_web (2.0.0)
@@ -1803,7 +1803,7 @@ DEPENDENCIES
knapsack (~> 1.21.1)
kramdown (~> 2.3.1)
kubeclient (~> 4.11.0)
- lefthook (~> 1.3.13)
+ lefthook (~> 1.4.0)
letter_opener_web (~> 2.0.0)
license_finder (~> 7.0)
licensee (~> 9.15)
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 175957ceabc..e8d638ed342 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -669,6 +669,9 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
validates :database_apdex_settings, json_schema: { filename: 'application_setting_database_apdex_settings' }, allow_nil: true
+ validates :namespace_aggregation_schedule_lease_duration_in_seconds,
+ numericality: { only_integer: true, greater_than: 0 }
+
attr_encrypted :asset_proxy_secret_key,
mode: :per_attribute_iv,
key: Settings.attr_encrypted_db_key_base_truncated,
diff --git a/app/services/ci/runners/stale_managers_cleanup_service.rb b/app/services/ci/runners/stale_managers_cleanup_service.rb
index b39f7315bc6..e216d8ea3d6 100644
--- a/app/services/ci/runners/stale_managers_cleanup_service.rb
+++ b/app/services/ci/runners/stale_managers_cleanup_service.rb
@@ -4,29 +4,32 @@ module Ci
module Runners
class StaleManagersCleanupService
MAX_DELETIONS = 1000
+ SUB_BATCH_LIMIT = 100
def execute
- ServiceResponse.success(payload: {
- # the `stale` relationship can return duplicates, so we don't try to return a precise count here
- deleted_managers: delete_stale_runner_managers > 0
- })
+ ServiceResponse.success(payload: delete_stale_runner_managers)
end
private
def delete_stale_runner_managers
+ batch_counts = []
total_deleted_count = 0
loop do
- sub_batch_limit = [100, MAX_DELETIONS].min
+ sub_batch_limit = [SUB_BATCH_LIMIT, MAX_DELETIONS].min
- # delete_all discards part of the `stale` scope query, so we expliclitly wrap it with a SELECT as a workaround
+ # delete_all discards part of the `stale` scope query, so we explicitly wrap it with a SELECT as a workaround
deleted_count = Ci::RunnerManager.id_in(Ci::RunnerManager.stale.limit(sub_batch_limit)).delete_all
+ batch_counts << deleted_count
total_deleted_count += deleted_count
break if deleted_count == 0 || total_deleted_count >= MAX_DELETIONS
end
- total_deleted_count
+ {
+ total_deleted: total_deleted_count,
+ batch_counts: batch_counts
+ }
end
end
end
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 92d584c525e..1c0e9d72118 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -91,6 +91,6 @@ cutoff = Date.today - 21 # Three weeks ago
old_migrations = database.find_migration_files_before(git.added_files, cutoff)
-if old_migrations.present?
+if old_migrations.any?
warn format(DB_OLD_MIGRATIONS_MESSAGE, old_migrations: old_migrations.map { |m| "* #{m}" }.join("\n"))
end
diff --git a/db/migrate/20230517090826_add_namespace_aggregation_schedule_lease_duration_to_application_settings.rb b/db/migrate/20230517090826_add_namespace_aggregation_schedule_lease_duration_to_application_settings.rb
new file mode 100644
index 00000000000..da7baeb0141
--- /dev/null
+++ b/db/migrate/20230517090826_add_namespace_aggregation_schedule_lease_duration_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddNamespaceAggregationScheduleLeaseDurationToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings,
+ :namespace_aggregation_schedule_lease_duration_in_seconds,
+ :integer,
+ default: 5.minutes,
+ null: false
+ end
+end
diff --git a/db/schema_migrations/20230517090826 b/db/schema_migrations/20230517090826
new file mode 100644
index 00000000000..cf060a2c151
--- /dev/null
+++ b/db/schema_migrations/20230517090826
@@ -0,0 +1 @@
+bfb3fe79af46a042287b1a0e86d79ad61c8ed2ac5e693d06249c52d8152de307 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 18ca4d27da1..99f0bde271c 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11835,6 +11835,7 @@ CREATE TABLE application_settings (
allow_account_deletion boolean DEFAULT true NOT NULL,
vertex_project text,
wiki_asciidoc_allow_uri_includes boolean DEFAULT false NOT NULL,
+ namespace_aggregation_schedule_lease_duration_in_seconds integer DEFAULT 300 NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
diff --git a/doc/ci/resource_groups/index.md b/doc/ci/resource_groups/index.md
index bae1bd9712b..74e3e493adb 100644
--- a/doc/ci/resource_groups/index.md
+++ b/doc/ci/resource_groups/index.md
@@ -75,7 +75,7 @@ The following modes are supported:
- **Unordered:** This is the default process mode that limits the concurrency on running jobs.
It's the easiest option to use when you don't care about the execution order
- of the jobs. It starts processing the jobs whenever a job ready to run.
+ of the jobs. It starts processing the jobs whenever a job is ready to run.
- **Oldest first:** This process mode limits the concurrency of the jobs. When a resource is free,
it picks the first job from the list of upcoming jobs (`created`, `scheduled`, or `waiting_for_resource` state)
that are sorted by pipeline ID in ascending order.
diff --git a/doc/user/analytics/value_streams_dashboard.md b/doc/user/analytics/value_streams_dashboard.md
index 528783f45f9..b207dff1f11 100644
--- a/doc/user/analytics/value_streams_dashboard.md
+++ b/doc/user/analytics/value_streams_dashboard.md
@@ -4,7 +4,7 @@ group: Optimize
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
-# Value Streams Dashboard (Beta) **(ULTIMATE)**
+# Value Streams Dashboard **(ULTIMATE)**
> - Introduced in GitLab 15.8 as a Closed [Beta](../../policy/alpha-beta-support.md#beta) feature [with a flag](../../administration/feature_flags.md) named `group_analytics_dashboards_page`. Disabled by default.
> - Released in GitLab 15.11 as an Open [Beta](../../policy/alpha-beta-support.md#beta) feature [with a flag](../../administration/feature_flags.md) named `group_analytics_dashboards_page`. Enabled by default.
@@ -21,17 +21,18 @@ For more information, see the [Value Stream Management category direction page](
Our initial use case is focused on providing the ability to compare software delivery metrics.
This comparison can help decision-makers understand whether projects and groups are improving.
-The beta version of the Value Streams Dashboard includes the following metrics:
+The Value Streams Dashboard includes the following metrics:
- [DORA metrics](dora_metrics.md)
- [Value Stream Analytics (VSA) - flow metrics](../group/value_stream_analytics/index.md)
+- [Vulnerabilities](https://gitlab.com/gitlab-org/gitlab/-/security/vulnerability_report) metrics.
The Value Streams Dashboard allows you to:
- Aggregate data records from different APIs.
- Track software performance (DORA) and flow of value (VSA) across the organization.
-## DevOps metrics comparison
+## DevOps metrics comparison panel
The DevOps metrics comparison displays DORA4 and flow metrics for a group or project in the
month-to-date, last month, the month before, and the past 180 days.
diff --git a/doc/user/group/index.md b/doc/user/group/index.md
index 7e093ccb01b..9ebf3be3000 100644
--- a/doc/user/group/index.md
+++ b/doc/user/group/index.md
@@ -21,10 +21,10 @@ For larger organizations, you can also create [subgroups](subgroups/index.md).
For more information about creating and managing your groups, see [Manage groups](manage.md).
NOTE:
-Self-managed customers should create a top-level group so you can see an overview of
-your organization. For more information about efforts to create an
+For self-managed customers it could be beneficial to create one single top-level group, so you can see an overview of
+your entire organization. For more information about efforts to create an
organization view of all groups, [see epic 9266](https://gitlab.com/groups/gitlab-org/-/epics/9266).
-A top-level group can also have one complete
+A single top-level group provides insights in your entire organization via a complete
[Security Dashboard and Center](../application_security/security_dashboard/index.md),
[Vulnerability](../application_security/vulnerability_report/index.md#vulnerability-report) and
[Compliance Report](../compliance/compliance_report/index.md), and
diff --git a/doc/user/group/manage.md b/doc/user/group/manage.md
index 871174d3281..17d4e7fc3df 100644
--- a/doc/user/group/manage.md
+++ b/doc/user/group/manage.md
@@ -9,10 +9,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Use groups to manage one or more related projects at the same time.
NOTE:
-Self-managed customers should create a top-level group so you can see an overview of
-your organization. For more information about efforts to create an
+For self-managed customers it could be beneficial to create one single top-level group, so you can see an overview of
+your entire organization. For more information about efforts to create an
organization view of all groups, [see epic 9266](https://gitlab.com/groups/gitlab-org/-/epics/9266).
-A top-level group can also have one complete
+A single top-level group provides insights in your entire organization via a complete
[Security Dashboard and Center](../application_security/security_dashboard/index.md),
[Vulnerability](../application_security/vulnerability_report/index.md#vulnerability-report) and
[Compliance Report](../compliance/compliance_report/index.md), and
diff --git a/lefthook.yml b/lefthook.yml
index 03a4903117f..2c9e7532ec6 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -61,7 +61,7 @@ pre-push:
glob: 'doc/*.md'
run: 'if [ $VALE_WARNINGS ]; then minWarnings=warning; else minWarnings=error; fi; if command -v vale > /dev/null 2>&1; then if ! vale --config .vale.ini --minAlertLevel $minWarnings {files}; then echo "ERROR: Fix any linting errors and make sure you are using the latest version of Vale."; exit 1; fi; else echo "ERROR: Vale not found. For more information, see https://docs.errata.ai/vale/install."; exit 1; fi'
gettext:
- skip: true # This is disabled by default. You can enable this check by adding skip: false in lefhook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
+ skip: true # This is disabled by default. You can enable this check by adding skip: false in lefthook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
tags: backend frontend view haml
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD | while read file;do git diff --unified=1 $(git merge-base origin/master HEAD)..HEAD $file | grep -Fqe '_(' && echo $file;done; true
glob: '*.{haml,rb,js,vue}'
@@ -92,7 +92,7 @@ pre-push:
glob: 'db/structure.sql'
run: scripts/validate_schema_changes
static-verification:
- skip: true # This is disabled by default. You can enable this check by adding skip: false in lefhook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
+ skip: true # This is disabled by default. You can enable this check by adding skip: false in lefthook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
tags: backend
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '*.{rb}'
@@ -100,7 +100,7 @@ pre-push:
scripts:
"merge_conflicts":
- skip: true # This is disabled by default. You can enable this check by adding skip: false in lefhook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
+ skip: true # This is disabled by default. You can enable this check by adding skip: false in lefthook-local.yml https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#skip
runner: bash
"security_harness":
tags: security
diff --git a/qa/Gemfile b/qa/Gemfile
index 04ef85031a3..81460c75440 100644
--- a/qa/Gemfile
+++ b/qa/Gemfile
@@ -3,7 +3,7 @@
source 'https://rubygems.org'
gem 'gitlab-qa', '~> 10', '>= 10.4.1', require: 'gitlab/qa'
-gem 'gitlab_quality-test_tooling', '~> 0.4.0', require: false
+gem 'gitlab_quality-test_tooling', '~> 0.4.1', require: false
gem 'activesupport', '~> 6.1.7.2' # This should stay in sync with the root's Gemfile
gem 'allure-rspec', '~> 2.20.0'
gem 'capybara', '~> 3.39.1'
@@ -26,7 +26,7 @@ gem 'rspec-parameterized', '~> 1.0.0'
gem 'octokit', '~> 6.1.1'
gem "faraday-retry", "~> 2.1"
gem 'webdrivers', '~> 5.2'
-gem 'zeitwerk', '~> 2.6', '>= 2.6.7'
+gem 'zeitwerk', '~> 2.6', '>= 2.6.8'
gem 'influxdb-client', '~> 2.9'
gem 'terminal-table', '~> 3.0.2', require: false
gem 'slack-notifier', '~> 2.4', require: false
@@ -40,7 +40,7 @@ gem 'chemlab', '~> 0.10'
gem 'chemlab-library-www-gitlab-com', '~> 0.1', '>= 0.1.1'
# dependencies for jenkins client
-gem 'nokogiri', '~> 1.15'
+gem 'nokogiri', '~> 1.15', '>= 1.15.1'
gem 'deprecation_toolkit', '~> 2.0.3', require: false
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index 1dcb41de816..bee3ac39096 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -111,7 +111,7 @@ GEM
rainbow (>= 3, < 4)
table_print (= 1.5.7)
zeitwerk (>= 2, < 3)
- gitlab_quality-test_tooling (0.4.0)
+ gitlab_quality-test_tooling (0.4.1)
activesupport (~> 6.1)
gitlab (~> 4.18.0)
http (~> 5.0)
@@ -190,7 +190,7 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
netrc (0.11.0)
- nokogiri (1.15.0)
+ nokogiri (1.15.1)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (6.1.1)
@@ -308,7 +308,7 @@ GEM
websocket (1.2.9)
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.6.7)
+ zeitwerk (2.6.8)
PLATFORMS
ruby
@@ -328,10 +328,10 @@ DEPENDENCIES
fog-core (= 2.1.0)
fog-google (~> 1.19)
gitlab-qa (~> 10, >= 10.4.1)
- gitlab_quality-test_tooling (~> 0.4.0)
+ gitlab_quality-test_tooling (~> 0.4.1)
influxdb-client (~> 2.9)
knapsack (~> 4.0)
- nokogiri (~> 1.15)
+ nokogiri (~> 1.15, >= 1.15.1)
octokit (~> 6.1.1)
parallel (~> 1.23)
parallel_tests (~> 4.2, >= 4.2.1)
@@ -350,7 +350,7 @@ DEPENDENCIES
terminal-table (~> 3.0.2)
warning (~> 1.3)
webdrivers (~> 5.2)
- zeitwerk (~> 2.6, >= 2.6.7)
+ zeitwerk (~> 2.6, >= 2.6.8)
BUNDLED WITH
2.4.13
diff --git a/qa/qa/tools/migrate_influx_data_to_gcs.rb b/qa/qa/tools/migrate_influx_data_to_gcs.rb
index 3313131275a..4933251511b 100644
--- a/qa/qa/tools/migrate_influx_data_to_gcs.rb
+++ b/qa/qa/tools/migrate_influx_data_to_gcs.rb
@@ -31,6 +31,7 @@ module QA
def self.run(range: 1)
migrator = new(range)
+ QA::Runtime::Logger.info("Fetching Influx data for the last #{range} hours")
migrator.migrate_data
end
@@ -102,9 +103,20 @@ module QA
# @param [String] bucket to be uploaded to
# @param [String] path of file to be uploaded
# return void
- def upload_to_gcs(bucket, file_path)
+ def upload_to_gcs(bucket, backup_file_path)
client = Fog::Storage::Google.new(google_project: QA_GCS_PROJECT_ID, **gcs_credentials)
- file = client.put_object(bucket, file_path, File.new(file_path, "r"))
+ file_path = backup_file_path.tr('_0-9', '')
+
+ # Backup older file
+ begin
+ QA::Runtime::Logger.info("Backing up older file to #{backup_file_path}")
+ client.copy_object(bucket, file_path, bucket, backup_file_path)
+ rescue Google::Apis::ClientError
+ QA::Runtime::Logger.warn("File #{file_path} is not found in GCS bucket, continuing with upload...")
+ end
+
+ # Upload new file
+ file = client.put_object(bucket, file_path, File.new(backup_file_path, "r"), force: true)
QA::Runtime::Logger.info("File #{file_path} uploaded to gs://#{bucket}/#{file.name}")
end
end
diff --git a/spec/factories/wiki_pages.rb b/spec/factories/wiki_pages.rb
index 9b4c8a4fced..093a2e9148f 100644
--- a/spec/factories/wiki_pages.rb
+++ b/spec/factories/wiki_pages.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require 'ostruct'
-
FactoryBot.define do
factory :wiki_page do
transient do
@@ -12,7 +10,7 @@ FactoryBot.define do
project { association(:project) }
container { project }
wiki { association(:wiki, container: container) }
- page { OpenStruct.new(url_path: title) }
+ page { ActiveSupport::InheritableOptions.new(url_path: title) }
end
initialize_with do
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index f4f571a000d..2706b8b12f7 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -276,6 +276,8 @@ RSpec.describe ApplicationSetting, feature_category: :shared, type: :model do
it { is_expected.to allow_value([true, false]).for(:remember_me_enabled) }
it { is_expected.not_to allow_value(nil).for(:remember_me_enabled) }
+ it { is_expected.to validate_numericality_of(:namespace_aggregation_schedule_lease_duration_in_seconds).only_integer.is_greater_than(0) }
+
context 'when deactivate_dormant_users is enabled' do
before do
stub_application_setting(deactivate_dormant_users: true)
diff --git a/spec/services/ci/runners/stale_managers_cleanup_service_spec.rb b/spec/services/ci/runners/stale_managers_cleanup_service_spec.rb
index a78506ca5f7..0a20c12bc15 100644
--- a/spec/services/ci/runners/stale_managers_cleanup_service_spec.rb
+++ b/spec/services/ci/runners/stale_managers_cleanup_service_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Ci::Runners::StaleManagersCleanupService, feature_category: :runn
it 'does not clean any runner managers and returns :success status' do
expect do
expect(response).to be_success
- expect(response.payload).to match({ deleted_managers: false })
+ expect(response.payload).to match({ total_deleted: 0, batch_counts: [0] })
end.not_to change { Ci::RunnerManager.count }.from(1)
end
end
@@ -25,10 +25,22 @@ RSpec.describe Ci::Runners::StaleManagersCleanupService, feature_category: :runn
it 'only leaves non-stale runners' do
expect(response).to be_success
- expect(response.payload).to match({ deleted_managers: true })
+ expect(response.payload).to match({ total_deleted: 2, batch_counts: [2, 0] })
expect(Ci::RunnerManager.all).to contain_exactly(runner_manager3)
end
+ context 'with more stale runners than SUB_BATCH_LIMIT' do
+ before do
+ stub_const("#{described_class}::SUB_BATCH_LIMIT", 1)
+ end
+
+ it 'only leaves non-stale runners' do
+ expect(response).to be_success
+ expect(response.payload).to match({ total_deleted: 2, batch_counts: [1, 1, 0] })
+ expect(Ci::RunnerManager.all).to contain_exactly(runner_manager3)
+ end
+ end
+
context 'with more stale runners than MAX_DELETIONS' do
before do
stub_const("#{described_class}::MAX_DELETIONS", 1)
@@ -37,7 +49,10 @@ RSpec.describe Ci::Runners::StaleManagersCleanupService, feature_category: :runn
it 'only leaves non-stale runners' do
expect do
expect(response).to be_success
- expect(response.payload).to match({ deleted_managers: true })
+ expect(response.payload).to match({
+ total_deleted: Ci::Runners::StaleManagersCleanupService::MAX_DELETIONS,
+ batch_counts: [1]
+ })
end.to change { Ci::RunnerManager.count }.by(-Ci::Runners::StaleManagersCleanupService::MAX_DELETIONS)
end
end
diff --git a/spec/workers/ci/runners/stale_machines_cleanup_cron_worker_spec.rb b/spec/workers/ci/runners/stale_machines_cleanup_cron_worker_spec.rb
index 619012eaa6e..79d1fadfd2b 100644
--- a/spec/workers/ci/runners/stale_machines_cleanup_cron_worker_spec.rb
+++ b/spec/workers/ci/runners/stale_machines_cleanup_cron_worker_spec.rb
@@ -26,7 +26,8 @@ RSpec.describe Ci::Runners::StaleMachinesCleanupCronWorker, feature_category: :r
expect(worker.logging_extras).to eq({
"extra.ci_runners_stale_machines_cleanup_cron_worker.status" => :success,
- "extra.ci_runners_stale_machines_cleanup_cron_worker.deleted_managers" => true
+ "extra.ci_runners_stale_machines_cleanup_cron_worker.total_deleted" => 1,
+ "extra.ci_runners_stale_machines_cleanup_cron_worker.batch_counts" => [1, 0]
})
end