chore: remove prompt enable outside resuce

This commit is contained in:
Shivam Mishra
2026-03-16 12:31:45 +05:30
parent e7d5924ca1
commit 1154f9ccb4
2 changed files with 20 additions and 1 deletions
+2 -1
View File
@@ -187,9 +187,10 @@ class ReportingEventsRollupBackfill # rubocop:disable Metrics/ClassLength
end
print_success(account, days_processed, total_days, Time.current - start_time)
prompt_enable_rollup_read_path(account)
rescue StandardError => e
print_failure(e, days_processed, total_days)
else
prompt_enable_rollup_read_path(account)
end
def print_success(account, days_processed, _total_days, elapsed_time)
@@ -31,6 +31,16 @@ describe ReportingEventsRollupBackfill do
service.send(:execute_backfill, account, date, date, 1)
end.to raise_error(SystemExit)
end
it 'does not report the backfill as failed when enabling the read path fails' do
allow(service).to receive(:print_success)
allow(service).to receive(:print_failure)
allow(service).to receive(:prompt_enable_rollup_read_path).and_raise(StandardError, 'toggle failed')
expect do
service.send(:execute_backfill, account, date, date, 1)
end.to raise_error(StandardError, 'toggle failed')
end
end
describe '#prompt_enable_rollup_read_path' do
@@ -49,5 +59,13 @@ describe ReportingEventsRollupBackfill do
service.send(:prompt_enable_rollup_read_path, account)
end
it 'skips the prompt when the feature is already enabled' do
allow(account).to receive(:feature_enabled?).with(:reporting_events_rollup).and_return(true)
expect($stdin).not_to receive(:gets)
service.send(:prompt_enable_rollup_read_path, account)
end
end
end