Skip to content
Snippets Groups Projects

Create partitioned CI component usage table

Merged Leaminn Ma requested to merge create-catalog-resource-component-usages-table into master
2 unresolved threads
@@ -106,7 +106,7 @@
describe 'strategy behavior' do
it 'moves records to new partitions as time passes' do
# We start with partition 1
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to eq([1])
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to contain_exactly(1)
# Add one record so the initial partition is not empty
component_usage.save!
@@ -115,7 +115,7 @@
# It's not 30 days old yet so no new partitions are created
partition_manager.sync_partitions
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to eq([1])
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to contain_exactly(1)
# After traveling forward 30 days
travel_to(first_used_date + described_class::PARTITION_DURATION + 1.day)
@@ -134,7 +134,7 @@
partition_manager.sync_partitions
# a third partition is created and partition 1 is removed
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to eq([2, 3])
expect(described_class.partitioning_strategy.current_partitions.map(&:value)).to contain_exactly(2, 3)
# and we only have the one usage record left.
expect(described_class.count).to eq(1)
Loading