Commit b163b72f authored by Stan Hu's avatar Stan Hu

Merge branch 'ab/remove-database-backup-spec' into 'master'

Remove failing database backup spec

See merge request gitlab-org/gitlab!35358
parents 83de92f4 def2ad97
# frozen_string_literal: true
require 'spec_helper'
describe Backup::Database do
let(:progress) { double('progress', print: nil, puts: nil) }
describe '#dump' do
subject { described_class.new(progress).dump }
let(:pg_schema) { nil }
let(:backup_config) { double('config', pg_schema: pg_schema, path: File.join(Rails.root, 'tmp')) }
before do
allow(Settings).to receive(:backup).and_return(backup_config)
allow(Process).to receive(:waitpid)
end
it 'does not limit pg_dump to any specific schema' do
expect(Process).to receive(:spawn) do |*cmd, _|
expect(cmd.join(' ')).not_to include('-n')
end
subject
end
it 'includes option to drop objects before restoration' do
expect(Process).to receive(:spawn) do |*cmd, _|
expect(cmd.join(' ')).to include('--clean')
end
subject
end
context 'with pg_schema configured explicitly' do
let(:pg_schema) { 'some_schema' }
it 'calls pg_dump' do
expect(Process).to receive(:spawn) do |*cmd, _|
expect(cmd.join(' ')).to start_with('pg_dump')
end
subject
end
it 'limits the psql dump to the specified schema' do
expect(Process).to receive(:spawn) do |*cmd, _|
expect(cmd.join(' ')).to include("-n #{pg_schema}")
end
subject
end
context 'extra schemas' do
Gitlab::Database::EXTRA_SCHEMAS.each do |schema|
it "includes the extra schema #{schema}" do
expect(Process).to receive(:spawn) do |*cmd, _|
expect(cmd.join(' ')).to include("-n #{schema}")
end
subject
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment