end
test "non-empty configuration.unlogged_attributes" do
- Rails.configuration.unlogged_attributes = ["manifest_text"]
+ Rails.configuration.AuditLogs.UnloggedAttributes = {"manifest_text"=>{}}
txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
act_as_system_user do
end
test "empty configuration.unlogged_attributes" do
- Rails.configuration.unlogged_attributes = []
+ Rails.configuration.AuditLogs.UnloggedAttributes = {}
txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
act_as_system_user do
test 'retain old audit logs with default settings' do
assert_no_logs_deleted do
AuditLogs.delete_old(
- max_age: Rails.configuration.max_audit_log_age,
- max_batch: Rails.configuration.max_audit_log_delete_batch)
+ max_age: Rails.configuration.AuditLogs.MaxAge,
+ max_batch: Rails.configuration.AuditLogs.MaxDeleteBatch)
end
end
test 'delete old audit logs in thread' do
begin
- Rails.configuration.max_audit_log_age = 20
- Rails.configuration.max_audit_log_delete_batch = 100000
+ Rails.configuration.AuditLogs.MaxAge = 20
+ Rails.configuration.AuditLogs.MaxDeleteBatch = 100000
Rails.cache.delete 'AuditLogs'
initial_log_count = Log.unscoped.all.count + 1
act_as_system_user do
sleep 0.1
end
assert_operator remaining_audit_logs.count, :<, initial_log_count
- ensure
- # The test framework rolls back our transactions, but that
- # doesn't undo the deletes we did from separate threads.
- ActiveRecord::Base.connection.exec_query 'ROLLBACK'
- Thread.new do
- begin
- dc = DatabaseController.new
- dc.define_singleton_method :render do |*args| end
- dc.reset
- ensure
- ActiveRecord::Base.connection.close
- end
- end.join
end
end
end