|
1499 | 1499 | end
|
1500 | 1500 | end
|
1501 | 1501 |
|
1502 |
| - context 'drop_error_types config option' do |
| 1502 | + describe 'drop_error_types' do |
1503 | 1503 |
|
1504 |
| - let(:error_type) { 'role_restriction_exception' } |
| 1504 | + let(:error_type) { 'index_closed_exception' } |
1505 | 1505 |
|
1506 | 1506 | let(:options) { super().merge('drop_error_types' => [error_type]) }
|
1507 | 1507 |
|
|
1511 | 1511 |
|
1512 | 1512 | let(:error_code) { 403 }
|
1513 | 1513 |
|
| 1514 | + let(:event_action_tuples) { subject.map_events(events) } |
| 1515 | + |
| 1516 | + let(:logger) { subject.logger } |
| 1517 | + |
1514 | 1518 | let(:bulk_response) do
|
1515 | 1519 | {
|
1516 | 1520 | "took"=>1, "ingest_took"=>11, "errors"=>true, "items"=>
|
|
1528 | 1532 |
|
1529 | 1533 | context 'DLQ is enabled' do
|
1530 | 1534 |
|
1531 |
| - it 'does not write the event to the DLQ' do |
| 1535 | + before(:each) do |
1532 | 1536 | allow(subject).to receive(:dlq_enabled?).and_return(true)
|
1533 |
| - expect(dlq_writer).not_to receive(:write) |
| 1537 | + end |
1534 | 1538 |
|
1535 |
| - event_action_tuples = subject.map_events(events) |
| 1539 | + it 'does not write the event to the DLQ' do |
| 1540 | + expect(dlq_writer).not_to receive(:write) |
1536 | 1541 | subject.send(:submit, event_action_tuples)
|
1537 | 1542 | end
|
1538 | 1543 | end
|
1539 | 1544 |
|
1540 | 1545 | context 'DLQ is not enabled' do
|
1541 | 1546 |
|
1542 |
| - it 'does not write the event to the DLQ' do |
| 1547 | + before(:each) do |
1543 | 1548 | allow(subject).to receive(:dlq_enabled?).and_return(false)
|
1544 |
| - expect(dlq_writer).not_to receive(:write) |
| 1549 | + end |
1545 | 1550 |
|
1546 |
| - event_action_tuples = subject.map_events(events) |
| 1551 | + it 'does not write the event to the DLQ' do |
| 1552 | + expect(dlq_writer).not_to receive(:write) |
1547 | 1553 | subject.send(:submit, event_action_tuples)
|
1548 | 1554 | end
|
1549 | 1555 | end
|
1550 | 1556 |
|
1551 | 1557 | context 'the error type is not in `silence_errors_in_log`' do
|
1552 | 1558 |
|
1553 |
| - let(:logger) { subject.logger } |
1554 |
| - |
1555 | 1559 | it 'logs the error' do
|
1556 | 1560 | expect(logger).to receive(:warn).with(a_string_including("Failed action"), anything).and_call_original
|
1557 |
| - |
1558 |
| - event_action_tuples = subject.map_events(events) |
1559 | 1561 | subject.send(:submit, event_action_tuples)
|
1560 | 1562 | end
|
1561 | 1563 | end
|
1562 | 1564 |
|
1563 | 1565 | context 'the error type is in `silence_errors_in_log`' do
|
1564 | 1566 |
|
1565 |
| - let(:logger) { subject.logger } |
1566 |
| - |
1567 | 1567 | let(:options) { super().merge('silence_errors_in_log' => [error_type]) }
|
1568 | 1568 |
|
1569 | 1569 | it 'does not log the error' do
|
1570 | 1570 | expect(logger).not_to receive(:warn)
|
1571 |
| - |
1572 |
| - event_action_tuples = subject.map_events(events) |
1573 | 1571 | subject.send(:submit, event_action_tuples)
|
1574 | 1572 | end
|
1575 | 1573 | end
|
|
0 commit comments