[DEPRECATE] no longer allow writing to ONLY cassandra for auditors
closes FOO-2045 flag=none TEST PLAN: 1) configure canvas to only write auditors to cassandra 2) run canvas 3) do auditable things (login, change course, flip flags) 4) postgres audit logs get written anyway Change-Id: Ide159791338a7cf5b3729c3a95a6549b1135f4ec Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266450 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
c52da6c883
commit
baee15675d
|
@ -90,7 +90,12 @@ module Audits
|
|||
# default to both for now.
|
||||
# after a year we will have hit our retention period
|
||||
# and can safely de-comission all auditors cassandra code.
|
||||
paths.empty? ? ['cassandra', 'active_record'] : paths
|
||||
return_paths = paths.empty? ? ['cassandra', 'active_record'] : paths
|
||||
unless return_paths.include?('active_record')
|
||||
logger.warn("[Auditors | DEPRECATION] Your auditors config attempts to not write to the relational db: #{paths}. This is deprecated, the intended future target for these audit records is postgres. Configuring to write to the db anyway.")
|
||||
return_paths.unshift('active_record')
|
||||
end
|
||||
return_paths
|
||||
end
|
||||
|
||||
def config(shard=::Switchman::Shard.current)
|
||||
|
|
|
@ -39,10 +39,10 @@ RSpec.describe Audits do
|
|||
end
|
||||
|
||||
describe "settings parsing" do
|
||||
it "parses pre-change write paths" do
|
||||
it "parses pre-change write paths, but WILL NOT allow not writing to postgres" do
|
||||
inject_auditors_settings("write_paths:\n - cassandra\nread_path: cassandra")
|
||||
expect(Audits.write_to_cassandra?).to eq(true)
|
||||
expect(Audits.write_to_postgres?).to eq(false)
|
||||
expect(Audits.write_to_postgres?).to eq(true)
|
||||
expect(Audits.read_from_cassandra?).to eq(true)
|
||||
expect(Audits.read_from_postgres?).to eq(false)
|
||||
end
|
||||
|
|
|
@ -23,6 +23,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../sharding_spec_helpe
|
|||
describe Auditors::ActiveRecord::CourseRecord do
|
||||
let(:request_id){ 'abcde-12345'}
|
||||
|
||||
before(:once) do
|
||||
Auditors::ActiveRecord::Partitioner.process
|
||||
end
|
||||
|
||||
it "it appropriately connected to a table" do
|
||||
expect(Auditors::ActiveRecord::CourseRecord.count).to eq(0)
|
||||
end
|
||||
|
|
|
@ -184,6 +184,12 @@ describe Auditors::Authentication do
|
|||
describe "sharding" do
|
||||
specs_require_sharding
|
||||
|
||||
before(:once) do
|
||||
[Shard.current, @shard1, @shard2].each do |s|
|
||||
s.activate{ Auditors::ActiveRecord::Partitioner.process }
|
||||
end
|
||||
end
|
||||
|
||||
context "different shard, same database server" do
|
||||
before do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -294,7 +294,7 @@ describe Auditors::GradeChange do
|
|||
end
|
||||
|
||||
it "inserts a record" do
|
||||
expect(Auditors::GradeChange::Stream).to receive(:insert).once
|
||||
expect(Auditors::GradeChange::Stream).to receive(:insert).at_least(:once)
|
||||
Auditors::GradeChange.record(submission: @submission)
|
||||
end
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ describe Auditors do
|
|||
end
|
||||
|
||||
describe "settings parsing" do
|
||||
it "parses pre-change write paths" do
|
||||
it "parses pre-change write paths (but with deprecation forces postgres writes)" do
|
||||
inject_auditors_settings("write_paths:\n - cassandra\nread_path: cassandra")
|
||||
expect(Auditors.write_to_cassandra?).to eq(true)
|
||||
expect(Auditors.write_to_postgres?).to eq(false)
|
||||
expect(Auditors.write_to_postgres?).to eq(true)
|
||||
expect(Auditors.read_from_cassandra?).to eq(true)
|
||||
expect(Auditors.read_from_postgres?).to eq(false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue