diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/config_checker | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/config_checker')
-rw-r--r-- | spec/lib/gitlab/config_checker/external_database_checker_spec.rb | 55 | ||||
-rw-r--r-- | spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb | 2 |
2 files changed, 30 insertions, 27 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 d86d132c237..316696bc584 100644 --- a/spec/lib/gitlab/config_checker/external_database_checker_spec.rb +++ b/spec/lib/gitlab/config_checker/external_database_checker_spec.rb @@ -2,55 +2,58 @@ require 'spec_helper' -describe Gitlab::ConfigChecker::ExternalDatabaseChecker do +RSpec.describe Gitlab::ConfigChecker::ExternalDatabaseChecker do describe '#check' do subject { described_class.check } - context 'database version is not deprecated' do + 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 before do - allow(described_class).to receive(:db_version_deprecated?).and_return(false) + 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 'database version is deprecated' do + context 'when database does not meet minimum version and there is no upcoming deprecation' do before do - allow(described_class).to receive(:db_version_deprecated?).and_return(true) - end - - let(:notice_deprecated_database) do - { - type: 'warning', - message: _('Note that PostgreSQL 11 will become the minimum required PostgreSQL version in GitLab 13.0 (May 2020). '\ - 'PostgreSQL 9.6 and PostgreSQL 10 will no longer be supported in GitLab 13.0. '\ - 'Please consider upgrading your PostgreSQL version (%{db_version}) soon.') % { db_version: Gitlab::Database.version.to_s } - } + 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 'reports deprecated database notices' do - is_expected.to contain_exactly(notice_deprecated_database) + 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 - end - describe '#db_version_deprecated' do - subject { described_class.db_version_deprecated? } - - context 'database version is not deprecated' do + context 'when database meets minimum version and there is an upcoming deprecation' do before do - allow(Gitlab::Database).to receive(:version).and_return(11) + allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(true) + allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(true) end - it { is_expected.to be false } + 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 'database version is deprecated' do + context 'when database does not meet minimum version and there is an upcoming deprecation' do before do - allow(Gitlab::Database).to receive(:version).and_return(10) + allow(Gitlab::Database).to receive(:postgresql_minimum_supported_version?).and_return(false) + allow(Gitlab::Database).to receive(:postgresql_upcoming_deprecation?).and_return(true) end - it { is_expected.to be true } + 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 end end diff --git a/spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb b/spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb index badfd56d571..afee3c5536e 100644 --- a/spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb +++ b/spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::ConfigChecker::PumaRuggedChecker do +RSpec.describe Gitlab::ConfigChecker::PumaRuggedChecker do describe '#check' do subject { described_class.check } |