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-03-22 18:09:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-22 18:09:49 +0300
commitf2dfd9ee819afb07bf11bd36a5f9d23009be0d39 (patch)
treeedd9468dc9c6c55f9882175fd83a1aadec22edf0 /spec/lib/gitlab/database
parent058c34839488502fcec48d805b83728f928a318c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/database')
-rw-r--r--spec/lib/gitlab/database/schema_cleaner_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/schema_cleaner_spec.rb b/spec/lib/gitlab/database/schema_cleaner_spec.rb
new file mode 100644
index 00000000000..ee9477156fb
--- /dev/null
+++ b/spec/lib/gitlab/database/schema_cleaner_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::Database::SchemaCleaner do
+ let(:example_schema) { fixture_file(File.join('gitlab', 'database', 'structure_example.sql')) }
+ let(:io) { StringIO.new }
+
+ subject do
+ described_class.new(example_schema).clean(io)
+ io.string
+ end
+
+ it 'removes comments on extensions' do
+ expect(subject).not_to include('COMMENT ON EXTENSION')
+ end
+
+ it 'includes the plpgsql extension' do
+ expect(subject).to include('CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;')
+ end
+
+ it 'sets the search_path' do
+ expect(subject.split("\n").first).to eq('SET search_path=public;')
+ end
+
+ it 'cleans up the full schema as expected (blackbox test with example)' do
+ expected_schema = fixture_file(File.join('gitlab', 'database', 'structure_example_cleaned.sql'))
+
+ expect(subject).to eq(expected_schema)
+ end
+end