Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pages_spec.rb « backup « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 095dda61cf41afe92d7931f6242c81efe705336f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Backup::Pages do
  let(:progress) { StringIO.new }

  subject { described_class.new(progress) }

  before do
    allow(File).to receive(:realpath).with("/var/gitlab-pages").and_return("/var/gitlab-pages")
    allow(File).to receive(:realpath).with("/var/gitlab-pages/..").and_return("/var")
  end

  describe '#dump' do
    it 'excludes tmp from backup tar' do
      allow(Gitlab.config.pages).to receive(:path) { '/var/gitlab-pages' }

      expect(subject).to receive(:tar).and_return('blabla-tar')
      expect(subject).to receive(:run_pipeline!).with([%w(blabla-tar --exclude=lost+found --exclude=./@pages.tmp -C /var/gitlab-pages -cf - .), 'gzip -c -1'], any_args).and_return([[true, true], ''])
      expect(subject).to receive(:pipeline_succeeded?).and_return(true)
      subject.dump('pages.tar.gz')
    end
  end
end