summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 13:14:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 13:14:44 +0000
commite7b5a68daecd0aff0cc66666cb38c7971027a05a (patch)
treeb153db785557cc807da5e623cb130a1ef384926e
parentc8fb2e6a3942330079bde06d919cd33c6bc7600e (diff)
downloadgitlab-ce-e7b5a68daecd0aff0cc66666cb38c7971027a05a.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
-rw-r--r--app/assets/javascripts/snippets/components/edit.vue2
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/graphql/resolvers/issue_status_counts_resolver.rb14
-rw-r--r--changelogs/unreleased/238569-fix-issuable-count-scope-graphql.yml5
-rw-r--r--changelogs/unreleased/239341-fix-snippets-create-without-file-path.yml5
-rw-r--r--changelogs/unreleased/backup_wrap_concurrency.yml5
-rw-r--r--changelogs/unreleased/remove-upcoming-db-deprecation-warning.yml5
-rw-r--r--changelogs/unreleased/security-group-rename-deletion.yml5
-rw-r--r--changelogs/unreleased/sh-fix-issue-241251.yml5
-rw-r--r--doc/administration/gitaly/praefect.md3
-rw-r--r--doc/ci/variables/README.md16
-rw-r--r--doc/ci/yaml/README.md28
-rw-r--r--doc/install/requirements.md2
-rw-r--r--lib/backup/repository.rb42
-rw-r--r--lib/gitlab/config_checker/external_database_checker.rb55
-rw-r--r--lib/gitlab/database.rb30
-rw-r--r--locale/gitlab.pot5
-rw-r--r--spec/controllers/groups_controller_spec.rb15
-rw-r--r--spec/frontend/snippets/components/edit_spec.js2
-rw-r--r--spec/graphql/resolvers/issue_status_counts_resolver_spec.rb35
-rw-r--r--spec/lib/backup/repository_spec.rb2
-rw-r--r--spec/lib/gitlab/config_checker/external_database_checker_spec.rb81
-rw-r--r--spec/lib/gitlab/database_spec.rb40
23 files changed, 187 insertions, 217 deletions
diff --git a/app/assets/javascripts/snippets/components/edit.vue b/app/assets/javascripts/snippets/components/edit.vue
index 6e3a670dc38..0978fcc7f93 100644
--- a/app/assets/javascripts/snippets/components/edit.vue
+++ b/app/assets/javascripts/snippets/components/edit.vue
@@ -63,7 +63,7 @@ export default {
return this.actions.length > 0;
},
hasValidBlobs() {
- return this.actions.every(x => x.filePath && x.content);
+ return this.actions.every(x => x.content);
},
updatePrevented() {
return this.snippet.title === '' || !this.hasValidBlobs || this.isUpdating;
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 2162d397da3..2d6f5d0377a 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -123,7 +123,7 @@ class GroupsController < Groups::ApplicationController
if Groups::UpdateService.new(@group, current_user, group_params).execute
redirect_to edit_group_path(@group, anchor: params[:update_section]), notice: "Group '#{@group.name}' was successfully updated."
else
- @group.path = @group.path_before_last_save || @group.path_was
+ @group.reset
render action: "edit"
end
end
diff --git a/app/graphql/resolvers/issue_status_counts_resolver.rb b/app/graphql/resolvers/issue_status_counts_resolver.rb
index 466ca538467..0b26b9def54 100644
--- a/app/graphql/resolvers/issue_status_counts_resolver.rb
+++ b/app/graphql/resolvers/issue_status_counts_resolver.rb
@@ -7,7 +7,21 @@ module Resolvers
type Types::IssueStatusCountsType, null: true
def continue_issue_resolve(parent, finder, **args)
+ finder.params[parent_param(parent)] = parent if parent
Gitlab::IssuablesCountForState.new(finder, parent)
end
+
+ private
+
+ def parent_param(parent)
+ case parent
+ when Project
+ :project_id
+ when Group
+ :group_id
+ else
+ raise "Unexpected type of parent: #{parent.class}. Must be Project or Group"
+ end
+ end
end
end
diff --git a/changelogs/unreleased/238569-fix-issuable-count-scope-graphql.yml b/changelogs/unreleased/238569-fix-issuable-count-scope-graphql.yml
new file mode 100644
index 00000000000..d2fa782b328
--- /dev/null
+++ b/changelogs/unreleased/238569-fix-issuable-count-scope-graphql.yml
@@ -0,0 +1,5 @@
+---
+title: Scope incident issue counts by given project or group
+merge_request: 40700
+author:
+type: fixed
diff --git a/changelogs/unreleased/239341-fix-snippets-create-without-file-path.yml b/changelogs/unreleased/239341-fix-snippets-create-without-file-path.yml
new file mode 100644
index 00000000000..9e3e412638e
--- /dev/null
+++ b/changelogs/unreleased/239341-fix-snippets-create-without-file-path.yml
@@ -0,0 +1,5 @@
+---
+title: Fix snippet save button disabled with empty file path
+merge_request: 40412
+author:
+type: fixed
diff --git a/changelogs/unreleased/backup_wrap_concurrency.yml b/changelogs/unreleased/backup_wrap_concurrency.yml
new file mode 100644
index 00000000000..28e2eaf483d
--- /dev/null
+++ b/changelogs/unreleased/backup_wrap_concurrency.yml
@@ -0,0 +1,5 @@
+---
+title: Fix race condition in concurrent backups
+merge_request: 39894
+author:
+type: fixed
diff --git a/changelogs/unreleased/remove-upcoming-db-deprecation-warning.yml b/changelogs/unreleased/remove-upcoming-db-deprecation-warning.yml
new file mode 100644
index 00000000000..c8615f26b1e
--- /dev/null
+++ b/changelogs/unreleased/remove-upcoming-db-deprecation-warning.yml
@@ -0,0 +1,5 @@
+---
+title: Display upcoming database deprecation warning only if current database version minimum is not met
+merge_request: 38225
+author:
+type: removed
diff --git a/changelogs/unreleased/security-group-rename-deletion.yml b/changelogs/unreleased/security-group-rename-deletion.yml
new file mode 100644
index 00000000000..57e22770344
--- /dev/null
+++ b/changelogs/unreleased/security-group-rename-deletion.yml
@@ -0,0 +1,5 @@
+---
+title: Prevent accidental group deletion if path rename fails
+merge_request: 40353
+author:
+type: fixed
diff --git a/changelogs/unreleased/sh-fix-issue-241251.yml b/changelogs/unreleased/sh-fix-issue-241251.yml
new file mode 100644
index 00000000000..7b822eefc3f
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-issue-241251.yml
@@ -0,0 +1,5 @@
+---
+title: Fix exception handling when a concurrent backup fails
+merge_request: 40451
+author:
+type: fixed
diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md
index 2e36a754c79..2e9e036c24e 100644
--- a/doc/administration/gitaly/praefect.md
+++ b/doc/administration/gitaly/praefect.md
@@ -940,6 +940,9 @@ cluster.
## Distributed reads
+> - Introduced in GitLab 13.1 in [beta](https://about.gitlab.com/handbook/product/gitlab-the-product/#alpha-beta-ga) with feature flag `gitaly_distributed_reads` set to disabled.
+> - [Made generally available](https://gitlab.com/gitlab-org/gitaly/-/issues/2951) in GitLab 13.3.
+
Praefect supports distribution of read operations across Gitaly nodes that are
configured for the virtual node.
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index 61bc466692e..8f0ec75973c 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -744,7 +744,11 @@ so `&&` is evaluated before `||`.
#### Parentheses
-> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230938) in GitLab 13.3
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230938) in GitLab 13.3
+> - It's deployed behind a feature flag, enabled by default.
+> - It's enabled on GitLab.com.
+> - It's recommended for production use.
+> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-parenthesis-support-for-variables-core-only). **(CORE ONLY)**
It is possible to use parentheses to group conditions. Parentheses have the highest
precedence of all operators. Expressions enclosed in parentheses are evaluated first,
@@ -760,20 +764,22 @@ Examples:
- `($VARIABLE1 =~ /^content.*/ || $VARIABLE2 =~ /thing$/) && $VARIABLE3`
- `$CI_COMMIT_BRANCH == "my-branch" || (($VARIABLE1 == "thing" || $VARIABLE2 == "thing") && $VARIABLE3)`
+##### Enable or disable parenthesis support for variables **(CORE ONLY)**
+
The feature is currently deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
can opt to disable it for your instance.
-To enable it:
+To disable it:
```ruby
-Feature.enable(:ci_if_parenthesis_enabled)
+Feature.disable(:ci_if_parenthesis_enabled)
```
-To disable it:
+To enable it:
```ruby
-Feature.disable(:ci_if_parenthesis_enabled)
+Feature.enable(:ci_if_parenthesis_enabled)
```
### Storing regular expressions in variables
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 694754a33d1..8d3ba1992b9 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -1548,6 +1548,22 @@ considered for their usage and behavior in this context. Future keyword improvem
are being discussed in our [epic for improving `rules`](https://gitlab.com/groups/gitlab-org/-/epics/2783),
where anyone can add suggestions or requests.
+You can use [parentheses](../variables/README.md#parentheses) with `&&` and `||` to build more complicated variable expressions.
+[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230938) in GitLab 13.3:
+
+```yaml
+job1:
+ script:
+ - echo This rule uses parentheses.
+ rules:
+ if: ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE
+```
+
+NOTE: **Note:**
+In GitLab 13.2 and older, the order of operations when mixing `||` and `&&` in a single rule may not have executed
+in the expected order. This is [fixed](https://gitlab.com/gitlab-org/gitlab/-/issues/230938)
+in GitLab 13.3.
+
### `only`/`except` (basic)
NOTE: **Note:**
@@ -1833,7 +1849,17 @@ end-to-end:
- $CI_COMMIT_MESSAGE =~ /skip-end-to-end-tests/
```
-Learn more about [variables expressions](../variables/README.md#environment-variables-expressions).
+You can use [parentheses](../variables/README.md#parentheses) with `&&` and `||` to build more complicated variable expressions.
+[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230938) in GitLab 13.3:
+
+```yaml
+job1:
+ script:
+ - echo This rule uses parentheses.
+ only:
+ variables:
+ - ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop") && $MY_VARIABLE
+```
#### `only:changes`/`except:changes`
diff --git a/doc/install/requirements.md b/doc/install/requirements.md
index 54fcfeb2ee4..4d9f09bb8b0 100644
--- a/doc/install/requirements.md
+++ b/doc/install/requirements.md
@@ -11,7 +11,7 @@ as the hardware requirements that are needed to install and use GitLab.
### Supported Linux distributions
-- Ubuntu (16.04/18.04)
+- Ubuntu (16.04/18.04/20.04)
- Debian (8/9/10)
- CentOS (6/7/8)
- openSUSE (Leap 15.1/Enterprise Server 12.2)
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 1daa29f00ef..51fac9e8706 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -26,13 +26,17 @@ module Backup
threads = Gitlab.config.repositories.storages.keys.map do |storage|
Thread.new do
- dump_storage(storage, semaphore, max_storage_concurrency: max_storage_concurrency)
- rescue => e
- errors << e
+ Rails.application.executor.wrap do
+ dump_storage(storage, semaphore, max_storage_concurrency: max_storage_concurrency)
+ rescue => e
+ errors << e
+ end
end
end
- threads.each(&:join)
+ ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
+ threads.each(&:join)
+ end
raise errors.pop unless errors.empty?
end
@@ -155,16 +159,18 @@ module Backup
threads = Array.new(max_storage_concurrency) do
Thread.new do
- while project = queue.pop
- semaphore.acquire
-
- begin
- dump_project(project)
- rescue => e
- errors << e
- break
- ensure
- semaphore.release
+ Rails.application.executor.wrap do
+ while project = queue.pop
+ semaphore.acquire
+
+ begin
+ dump_project(project)
+ rescue => e
+ errors << e
+ break
+ ensure
+ semaphore.release
+ end
end
end
end
@@ -176,10 +182,12 @@ module Backup
queue.push(project)
end
- queue.close
- threads.each(&:join)
-
raise errors.pop unless errors.empty?
+ ensure
+ queue.close
+ ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
+ threads.each(&:join)
+ end
end
def dump_project(project)
diff --git a/lib/gitlab/config_checker/external_database_checker.rb b/lib/gitlab/config_checker/external_database_checker.rb
index dfcdbdf39e0..606d45e0f0f 100644
--- a/lib/gitlab/config_checker/external_database_checker.rb
+++ b/lib/gitlab/config_checker/external_database_checker.rb
@@ -6,48 +6,21 @@ module Gitlab
extend self
def check
- notices = []
-
- unless Gitlab::Database.postgresql_minimum_supported_version?
- string_args = {
- pg_version_current: Gitlab::Database.version,
- pg_version_minimum: Gitlab::Database::MINIMUM_POSTGRES_VERSION,
- pg_requirements_url_open: '<a href="https://docs.gitlab.com/ee/install/requirements.html#database">'.html_safe,
- pg_requirements_url_close: '</a>'.html_safe
+ return [] if Gitlab::Database.postgresql_minimum_supported_version?
+
+ [
+ {
+ type: 'warning',
+ message: _('You are using PostgreSQL %{pg_version_current}, but PostgreSQL ' \
+ '%{pg_version_minimum} is required for this version of GitLab. ' \
+ 'Please upgrade your environment to a supported PostgreSQL version, ' \
+ 'see %{pg_requirements_url} for details.') % {
+ pg_version_current: Gitlab::Database.version,
+ pg_version_minimum: Gitlab::Database::MINIMUM_POSTGRES_VERSION,
+ pg_requirements_url: '<a href="https://docs.gitlab.com/ee/install/requirements.html#database">database requirements</a>'
+ }
}
-
- notices <<
- {
- type: 'warning',
- message: html_escape(_('You are using PostgreSQL %{pg_version_current}, but PostgreSQL ' \
- '%{pg_version_minimum} is required for this version of GitLab. ' \
- 'Please upgrade your environment to a supported PostgreSQL version, ' \
- 'see %{pg_requirements_url_open}database requirements%{pg_requirements_url_close} for details.')) % string_args
- }
- end
-
- if Gitlab::Database.postgresql_upcoming_deprecation? && Gitlab::Database.within_deprecation_notice_window?
- upcoming_deprecation = Gitlab::Database::UPCOMING_POSTGRES_VERSION_DETAILS
-
- string_args = {
- pg_version_upcoming: upcoming_deprecation[:pg_version_minimum],
- gl_version_upcoming: upcoming_deprecation[:gl_version],
- gl_version_upcoming_date: upcoming_deprecation[:gl_version_date],
- pg_version_upcoming_url_open: "<a href=\"#{upcoming_deprecation[:url]}\">".html_safe,
- pg_version_upcoming_url_close: '</a>'.html_safe
- }
-
- notices <<
- {
- type: 'warning',
- message: html_escape(_('Note that PostgreSQL %{pg_version_upcoming} will become the minimum required ' \
- 'version in GitLab %{gl_version_upcoming} (%{gl_version_upcoming_date}). Please ' \
- 'consider upgrading your environment to a supported PostgreSQL version soon, ' \
- 'see %{pg_version_upcoming_url_open}the related epic%{pg_version_upcoming_url_close} for details.')) % string_args
- }
- end
-
- notices
+ ]
end
end
end
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index e7df9fd27f0..990c940d200 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -6,20 +6,6 @@ module Gitlab
# https://docs.gitlab.com/ee/install/requirements.html#postgresql-requirements
MINIMUM_POSTGRES_VERSION = 11
- # Upcoming PostgreSQL version requirements
- # Allows a soft warning about an upcoming minimum version requirement
- # so administrators can prepare to upgrade
- UPCOMING_POSTGRES_VERSION_DETAILS = {
- gl_version: '13.6.0',
- gl_version_date: 'November 22, 2020',
- pg_version_minimum: 12,
- url: 'https://gitlab.com/groups/gitlab-org/-/epics/2374'
- }.freeze
-
- # Specifies the maximum number of days in advance to display a notice
- # regarding an upcoming PostgreSQL version deprecation.
- DEPRECATION_WINDOW_DAYS = 90
-
# https://www.postgresql.org/docs/9.2/static/datatype-numeric.html
MAX_INT_VALUE = 2147483647
MIN_INT_VALUE = -2147483648
@@ -114,22 +100,6 @@ module Gitlab
version.to_f >= MINIMUM_POSTGRES_VERSION
end
- def self.postgresql_upcoming_deprecation?
- version.to_f < UPCOMING_POSTGRES_VERSION_DETAILS[:pg_version_minimum]
- end
-
- def self.days_until_deprecation
- (
- Date.parse(UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) -
- Date.today
- ).to_i
- end
- private_class_method :days_until_deprecation
-
- def self.within_deprecation_notice_window?
- days_until_deprecation <= DEPRECATION_WINDOW_DAYS
- end
-
def self.check_postgres_version_and_print_warning
return if Gitlab::Database.postgresql_minimum_supported_version?
return if Gitlab::Runtime.rails_runner?
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 050b08dc32f..f3bba0d4e25 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -16610,9 +16610,6 @@ msgstr ""
msgid "Note parameters are invalid: %{errors}"
msgstr ""
-msgid "Note that PostgreSQL %{pg_version_upcoming} will become the minimum required version in GitLab %{gl_version_upcoming} (%{gl_version_upcoming_date}). Please consider upgrading your environment to a supported PostgreSQL version soon, see %{pg_version_upcoming_url_open}the related epic%{pg_version_upcoming_url_close} for details."
-msgstr ""
-
msgid "Note that this invitation was sent to %{mail_to_invite_email}, but you are signed in as %{link_to_current_user} with email %{mail_to_current_user}."
msgstr ""
@@ -27906,7 +27903,7 @@ msgstr ""
msgid "You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico."
msgstr ""
-msgid "You are using PostgreSQL %{pg_version_current}, but PostgreSQL %{pg_version_minimum} is required for this version of GitLab. Please upgrade your environment to a supported PostgreSQL version, see %{pg_requirements_url_open}database requirements%{pg_requirements_url_close} for details."
+msgid "You are using PostgreSQL %{pg_version_current}, but PostgreSQL %{pg_version_minimum} is required for this version of GitLab. Please upgrade your environment to a supported PostgreSQL version, see %{pg_requirements_url} for details."
msgstr ""
msgid "You can %{linkStart}view the blob%{linkEnd} instead."
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index 469e58c94e7..78de89de796 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -555,6 +555,21 @@ RSpec.describe GroupsController do
end
end
+ context 'when there is a conflicting group path' do
+ render_views
+
+ let!(:conflict_group) { create(:group, path: SecureRandom.hex(12) ) }
+ let!(:old_name) { group.name }
+
+ it 'does not render references to the conflicting group' do
+ put :update, params: { id: group.to_param, group: { path: conflict_group.path } }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(group.reload.name).to eq(old_name)
+ expect(response.body).not_to include(conflict_group.path)
+ end
+ end
+
context 'when a project inside the group has container repositories' do
before do
stub_container_registry_config(enabled: true)
diff --git a/spec/frontend/snippets/components/edit_spec.js b/spec/frontend/snippets/components/edit_spec.js
index 980855a0615..ebab6aa84f6 100644
--- a/spec/frontend/snippets/components/edit_spec.js
+++ b/spec/frontend/snippets/components/edit_spec.js
@@ -179,7 +179,7 @@ describe('Snippet Edit app', () => {
${'foo'} | ${[]} | ${false}
${'foo'} | ${[TEST_ACTIONS.VALID]} | ${false}
${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_CONTENT]} | ${true}
- ${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_PATH]} | ${true}
+ ${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_PATH]} | ${false}
`(
'should handle submit disable (title=$title, actions=$actions, shouldDisable=$shouldDisable)',
async ({ title, actions, shouldDisable }) => {
diff --git a/spec/graphql/resolvers/issue_status_counts_resolver_spec.rb b/spec/graphql/resolvers/issue_status_counts_resolver_spec.rb
index d2412db35c6..69e940ee6ca 100644
--- a/spec/graphql/resolvers/issue_status_counts_resolver_spec.rb
+++ b/spec/graphql/resolvers/issue_status_counts_resolver_spec.rb
@@ -7,14 +7,21 @@ RSpec.describe Resolvers::IssueStatusCountsResolver do
describe '#resolve' do
let_it_be(:current_user) { create(:user) }
- let_it_be(:project) { create(:project) }
- let_it_be(:issue) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project) { create(:project, group: group) }
+ let_it_be(:issue) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) }
let_it_be(:incident) { create(:incident, project: project, state: :closed, created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago) }
+ # This issue should not be included in the counts
+ let_it_be(:other_project) { create(:project) }
+ let_it_be(:other_proj_issue) { create(:issue, state: :opened, project: other_project) }
+
+ let(:parent) { project }
let(:args) { {} }
- before do
+ before_all do
project.add_developer(current_user)
+ other_project.add_developer(current_user)
end
subject { resolve_issue_status_counts(args) }
@@ -22,12 +29,22 @@ RSpec.describe Resolvers::IssueStatusCountsResolver do
it { is_expected.to be_a(Gitlab::IssuablesCountForState) }
specify { expect(subject.project).to eq(project) }
- it 'returns expected results' do
- result = resolve_issue_status_counts
+ shared_examples 'returns expected results' do
+ it 'returns expected results', :aggregate_failures do
+ result = resolve_issue_status_counts
- expect(result.all).to eq 2
- expect(result.opened).to eq 1
- expect(result.closed).to eq 1
+ expect(result.all).to eq 2
+ expect(result.opened).to eq 1
+ expect(result.closed).to eq 1
+ end
+ end
+
+ it_behaves_like 'returns expected results'
+
+ context 'group used as parent' do
+ let(:parent) { project.group }
+
+ it_behaves_like 'returns expected results'
end
it 'filters by search', :aggregate_failures do
@@ -58,7 +75,7 @@ RSpec.describe Resolvers::IssueStatusCountsResolver do
private
def resolve_issue_status_counts(args = {}, context = { current_user: current_user })
- resolve(described_class, obj: project, args: args, ctx: context)
+ resolve(described_class, obj: parent, args: args, ctx: context)
end
end
end
diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb
index fef5e018231..c4ad239f9d7 100644
--- a/spec/lib/backup/repository_spec.rb
+++ b/spec/lib/backup/repository_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe Backup::Repository do
end
[4, 10].each do |max_storage_concurrency|
- context "max_storage_concurrency #{max_storage_concurrency}" do
+ context "max_storage_concurrency #{max_storage_concurrency}", quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/241701' do
it 'creates the expected number of threads' do
expect(Thread).to receive(:new)
.exactly(storage_keys.length * (max_storage_concurrency + 1)).times
diff --git a/spec/lib/gitlab/config_checker/external_database_checker_spec.rb b/spec/lib/gitlab/config_checker/external_database_checker_spec.rb
index 712903e020a..85bafc77553 100644
--- a/spec/lib/gitlab/config_checker/external_database_checker_spec.rb
+++ b/spec/lib/gitlab/config_checker/external_database_checker_spec.rb
@@ -6,84 +6,35 @@ RSpec.describe Gitlab::ConfigChecker::ExternalDatabaseChecker do
describe '#check' do
subject { described_class.check }
- let_it_be(:deprecation_warning) { "Please upgrade" }
- let_it_be(:upcoming_deprecation_warning) { "Please consider upgrading" }
-
- context 'when database meets minimum version and there is no upcoming deprecation' do
+ context 'when database meets minimum supported version' do
before do
allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(true)
- allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(false)
end
it { is_expected.to be_empty }
end
- context 'when database does not meet minimum version and there is no upcoming deprecation' do
+ context 'when database does not meet minimum supported version' do
before do
allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(false)
- allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(false)
- end
-
- it 'only returns notice about deprecated database version' do
- is_expected.to include(a_hash_including(message: include(deprecation_warning)))
- is_expected.not_to include(a_hash_including(message: include(upcoming_deprecation_warning)))
end
- end
- context 'when database meets minimum version and there is an upcoming deprecation' do
- before do
- allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(true)
- allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(true)
+ let(:notice_deprecated_database) do
+ {
+ type: 'warning',
+ message: _('You are using PostgreSQL %{pg_version_current}, but PostgreSQL ' \
+ '%{pg_version_minimum} is required for this version of GitLab. ' \
+ 'Please upgrade your environment to a supported PostgreSQL version, ' \
+ 'see %{pg_requirements_url} for details.') % {
+ pg_version_current: Gitlab::Database.version,
+ pg_version_minimum: Gitlab::Database::MINIMUM_POSTGRES_VERSION,
+ pg_requirements_url: '<a href="https://docs.gitlab.com/ee/install/requirements.html#database">database requirements</a>'
+ }
+ }
end
- context 'inside the deprecation notice window' do
- before do
- allow(Gitlab::Database).to receive(:within_deprecation_notice_window?).and_return(true)
- end
-
- it 'only returns notice about an upcoming deprecation' do
- is_expected.to include(a_hash_including(message: include(upcoming_deprecation_warning)))
- is_expected.not_to include(a_hash_including(message: include(deprecation_warning)))
- end
- end
-
- context 'outside the deprecation notice window' do
- before do
- allow(Gitlab::Database).to receive(:within_deprecation_notice_window?).and_return(false)
- end
-
- it { is_expected.to be_empty }
- end
- end
-
- context 'when database does not meet minimum version and there is an upcoming deprecation' do
- before do
- allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(false)
- allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(true)
- end
-
- context 'inside the deprecation notice window' do
- before do
- allow(Gitlab::Database).to receive(:within_deprecation_notice_window?).and_return(true)
- end
-
- it 'returns notice about deprecated database version and an upcoming deprecation' do
- is_expected.to include(
- a_hash_including(message: include(deprecation_warning)),
- a_hash_including(message: include(upcoming_deprecation_warning))
- )
- end
- end
-
- context 'outside the deprecation notice window' do
- before do
- allow(Gitlab::Database).to receive(:within_deprecation_notice_window?).and_return(false)
- end
-
- it 'only returns notice about deprecated database version' do
- is_expected.to include(a_hash_including(message: include(deprecation_warning)))
- is_expected.not_to include(a_hash_including(message: include(upcoming_deprecation_warning)))
- end
+ it 'reports deprecated database notice' do
+ is_expected.to contain_exactly(notice_deprecated_database)
end
end
end
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index 47d2cb05240..420aa0a8df6 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -109,46 +109,6 @@ RSpec.describe Gitlab::Database do
end
end
- describe '.postgresql_upcoming_deprecation?' do
- it 'returns true when database version is lower than the upcoming minimum' do
- allow(described_class).to receive(:version).and_return('11')
-
- expect(described_class.postgresql_upcoming_deprecation?).to eq(true)
- end
-
- it 'returns false when database version equals the upcoming minimum' do
- allow(described_class).to receive(:version).and_return('12')
-
- expect(described_class.postgresql_upcoming_deprecation?).to eq(false)
- end
-
- it 'returns false when database version is greater the upcoming minimum' do
- allow(described_class).to receive(:version).and_return('13')
-
- expect(described_class.postgresql_upcoming_deprecation?).to eq(false)
- end
- end
-
- describe '.within_deprecation_notice_window?' do
- using RSpec::Parameterized::TableSyntax
-
- where(:case_name, :days, :result) do
- 'outside window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS + 1 | false
- 'equal to window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS | true
- 'within window' | Gitlab::Database::DEPRECATION_WINDOW_DAYS - 1 | true
- end
-
- with_them do
- it "returns #{params[:result]} when #{params[:case_name]}" do
- allow(Date)
- .to receive(:today)
- .and_return Date.parse(Gitlab::Database::UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) - days
-
- expect(described_class.within_deprecation_notice_window?).to eq(result)
- end
- end
- end
-
describe '.check_postgres_version_and_print_warning' do
subject { described_class.check_postgres_version_and_print_warning }