summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/config_checker
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/config_checker
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/config_checker')
-rw-r--r--spec/lib/gitlab/config_checker/external_database_checker_spec.rb56
1 files changed, 56 insertions, 0 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
new file mode 100644
index 00000000000..d86d132c237
--- /dev/null
+++ b/spec/lib/gitlab/config_checker/external_database_checker_spec.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::ConfigChecker::ExternalDatabaseChecker do
+ describe '#check' do
+ subject { described_class.check }
+
+ context 'database version is not deprecated' do
+ before do
+ allow(described_class).to receive(:db_version_deprecated?).and_return(false)
+ end
+
+ it { is_expected.to be_empty }
+ end
+
+ context 'database version is deprecated' 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 }
+ }
+ end
+
+ it 'reports deprecated database notices' do
+ is_expected.to contain_exactly(notice_deprecated_database)
+ end
+ end
+ end
+
+ describe '#db_version_deprecated' do
+ subject { described_class.db_version_deprecated? }
+
+ context 'database version is not deprecated' do
+ before do
+ allow(Gitlab::Database).to receive(:version).and_return(11)
+ end
+
+ it { is_expected.to be false }
+ end
+
+ context 'database version is deprecated' do
+ before do
+ allow(Gitlab::Database).to receive(:version).and_return(10)
+ end
+
+ it { is_expected.to be true }
+ end
+ end
+end