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

detached_partition_spec.rb « postgresql « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d9e77b703688793ad01866a121467f3812c3732d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Postgresql::DetachedPartition do
  describe '#ready_to_drop' do
    let_it_be(:drop_before) { described_class.create!(drop_after: 1.day.ago, table_name: 'old_table') }
    let_it_be(:drop_after) { described_class.create!(drop_after: 1.day.from_now, table_name: 'new_table') }

    it 'includes partitions that should be dropped before now' do
      expect(described_class.ready_to_drop.to_a).to include(drop_before)
    end

    it 'does not include partitions that should be dropped after now' do
      expect(described_class.ready_to_drop.to_a).not_to include(drop_after)
    end
  end
end