diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/models/postgresql/detached_partition_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/models/postgresql/detached_partition_spec.rb')
-rw-r--r-- | spec/models/postgresql/detached_partition_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/postgresql/detached_partition_spec.rb b/spec/models/postgresql/detached_partition_spec.rb new file mode 100644 index 00000000000..aaa99e842b4 --- /dev/null +++ b/spec/models/postgresql/detached_partition_spec.rb @@ -0,0 +1,18 @@ +# 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 |