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>2020-08-28 16:14:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 16:14:44 +0300
commite7b5a68daecd0aff0cc66666cb38c7971027a05a (patch)
treeb153db785557cc807da5e623cb130a1ef384926e /spec/lib/gitlab/config_checker/external_database_checker_spec.rb
parentc8fb2e6a3942330079bde06d919cd33c6bc7600e (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/lib/gitlab/config_checker/external_database_checker_spec.rb')
-rw-r--r--spec/lib/gitlab/config_checker/external_database_checker_spec.rb81
1 files changed, 16 insertions, 65 deletions
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