debian-mirror-gitlab/spec/models/postgresql/detached_partition_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
717 B
Ruby
Raw Normal View History

2021-10-27 15:23:28 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Postgresql::DetachedPartition do
describe '#ready_to_drop' do
let_it_be(:drop_before) { Postgresql::DetachedPartition.create!(drop_after: 1.day.ago, table_name: 'old_table') }
let_it_be(:drop_after) { Postgresql::DetachedPartition.create!(drop_after: 1.day.from_now, table_name: 'new_table') }
it 'includes partitions that should be dropped before now' do
expect(Postgresql::DetachedPartition.ready_to_drop.to_a).to include(drop_before)
end
it 'does not include partitions that should be dropped after now' do
expect(Postgresql::DetachedPartition.ready_to_drop.to_a).not_to include(drop_after)
end
end
end