summaryrefslogtreecommitdiff
path: root/spec/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-25 00:09:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-25 00:09:26 +0000
commit5d6119a1a4d31009ea7aee400c8462e897ddc26c (patch)
treeb648d64a6cbcb9195325a258715ba23633f88984 /spec/db
parentd627a16f3d10e2188ae2b2797e042f4c324718db (diff)
downloadgitlab-ce-5d6119a1a4d31009ea7aee400c8462e897ddc26c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/db')
-rw-r--r--spec/db/schema_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index 51ffd143836..be138992a60 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -202,6 +202,36 @@ RSpec.describe 'Database schema' do
end
end
+ context 'existence of Postgres schemas' do
+ def get_schemas
+ sql = <<~SQL
+ SELECT schema_name FROM
+ information_schema.schemata
+ WHERE
+ NOT schema_name ~* '^pg_' AND NOT schema_name = 'information_schema'
+ AND catalog_name = current_database()
+ SQL
+
+ ApplicationRecord.connection.select_all(sql).map do |row|
+ row['schema_name']
+ end
+ end
+
+ it 'we have a public schema' do
+ expect(get_schemas).to include('public')
+ end
+
+ Gitlab::Database::EXTRA_SCHEMAS.each do |schema|
+ it "we have a '#{schema}' schema'" do
+ expect(get_schemas).to include(schema.to_s)
+ end
+ end
+
+ it 'we do not have unexpected schemas' do
+ expect(get_schemas.size).to eq(Gitlab::Database::EXTRA_SCHEMAS.size + 1)
+ end
+ end
+
private
def retrieve_columns_name_with_jsonb