|
1513 | 1513 |
|
1514 | 1514 | let(:event_action_tuples) { subject.map_events(events) } |
1515 | 1515 |
|
1516 | | - let(:logger) { subject.logger } |
1517 | | - |
1518 | 1516 | let(:bulk_response) do |
1519 | 1517 | { |
1520 | 1518 | "took"=>1, "ingest_took"=>11, "errors"=>true, "items"=> |
|
1532 | 1530 |
|
1533 | 1531 | context 'DLQ is enabled' do |
1534 | 1532 |
|
1535 | | - before(:each) do |
1536 | | - allow(subject).to receive(:dlq_enabled?).and_return(true) |
1537 | | - end |
| 1533 | + let(:options) { super().merge("dlq_custom_codes" => [403]) } |
1538 | 1534 |
|
1539 | 1535 | it 'does not write the event to the DLQ' do |
1540 | 1536 | expect(dlq_writer).not_to receive(:write) |
|
1548 | 1544 | allow(subject).to receive(:dlq_enabled?).and_return(false) |
1549 | 1545 | end |
1550 | 1546 |
|
1551 | | - it 'does not write the event to the DLQ' do |
1552 | | - expect(dlq_writer).not_to receive(:write) |
1553 | | - subject.send(:submit, event_action_tuples) |
| 1547 | + it 'does not retry indexing the event' do |
| 1548 | + expect(subject).to receive(:submit).with(event_action_tuples).once.and_call_original |
| 1549 | + subject.send(:retrying_submit, event_action_tuples) |
1554 | 1550 | end |
1555 | 1551 | end |
1556 | 1552 |
|
1557 | 1553 | context 'the error type is not in `silence_errors_in_log`' do |
1558 | 1554 |
|
1559 | 1555 | it 'logs the error' do |
1560 | | - expect(logger).to receive(:warn).with(a_string_including("Failed action"), anything).and_call_original |
| 1556 | + expect(subject.logger).to receive(:warn).with(a_string_including("Failed action"), anything) |
1561 | 1557 | subject.send(:submit, event_action_tuples) |
1562 | 1558 | end |
1563 | 1559 | end |
|
1566 | 1562 |
|
1567 | 1563 | let(:options) { super().merge('silence_errors_in_log' => [error_type]) } |
1568 | 1564 |
|
| 1565 | + before(:each) do |
| 1566 | + # ensure that neither warn nor info is called on the logger by using a test double |
| 1567 | + subject.instance_variable_set("@logger", double('logger')) |
| 1568 | + end |
| 1569 | + |
1569 | 1570 | it 'does not log the error' do |
1570 | | - expect(logger).not_to receive(:warn) |
1571 | 1571 | subject.send(:submit, event_action_tuples) |
1572 | 1572 | end |
1573 | 1573 | end |
|
0 commit comments