FF Auditor errors should be raised

CLOSES FOO-2233
flag=none

TEST PLAN:
  1) destroy partitions for auditors
  2) try to write a FF update
  3) error gets raised obviously

Change-Id: Id9b40b54c84b77548f1f17724972b027c679d960
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270604
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Ethan Vizitei 2021-08-03 10:23:34 -05:00
parent c3e4c5ceac
commit 0e98ac9bb6
2 changed files with 7 additions and 0 deletions

View File

@ -103,6 +103,7 @@ class Auditors::FeatureFlag
table :feature_flags table :feature_flags
record_type Auditors::FeatureFlag::Record record_type Auditors::FeatureFlag::Record
read_consistency_level -> { CanvasCassandra::DatabaseBuilder.read_consistency_setting(:auditors) } read_consistency_level -> { CanvasCassandra::DatabaseBuilder.read_consistency_setting(:auditors) }
self.raise_on_error = true
add_index :feature_flag do add_index :feature_flag do
table :feature_flag_changes_by_feature_flag table :feature_flag_changes_by_feature_flag

View File

@ -107,5 +107,11 @@ describe Auditors::FeatureFlag do
pg_record = Auditors::ActiveRecord::FeatureFlagRecord.where(uuid: @event.id).first pg_record = Auditors::ActiveRecord::FeatureFlagRecord.where(uuid: @event.id).first
expect(Auditors::FeatureFlag.for_feature_flag(@flag).paginate(per_page: 10)).to include(pg_record) expect(Auditors::FeatureFlag.for_feature_flag(@flag).paginate(per_page: 10)).to include(pg_record)
end end
it "does not swallow auditor write errors" do
test_err_class = Class.new(StandardError){ }
allow(Auditors::ActiveRecord::FeatureFlagRecord).to receive(:create_from_event_stream!).and_raise(test_err_class.new("DB Error"))
expect { Auditors::FeatureFlag.record(@flag, @user, 'on') }.to raise_error(test_err_class)
end
end end
end end