signalapp/ringrtc

Errors in unit test

n0sign4l-official opened this issue · 2 comments

Hi I was wondering why there are some errors in the test
https://github.com/signalapp/ringrtc/runs/1460070509
for example at line 754

Error: 8 [ERROR] send_next_message(): closure failed Simulation: Intentional: Send answer failed

but the tests seam to pass?

As the error message says, it is:

Intentional

Let's look at nearby log lines:

2020-11-26T16:48:58.3661150Z      Running /tmp/ringrtc-tests/debug/deps/incoming-062a004f238b1b10
2020-11-26T16:48:58.3681536Z 
2020-11-26T16:48:58.3681951Z running 11 tests
2020-11-26T16:48:58.3682825Z test inbound_call_connected ... 
2020-11-26T16:48:58.3683292Z *** Using random seed: 1606409211
2020-11-26T16:48:58.3870961Z ok
2020-11-26T16:48:58.4052070Z test inbound_call_hangup_accepted ... ok
2020-11-26T16:48:58.4235399Z test inbound_call_hangup_busy ... ok
2020-11-26T16:48:58.4399611Z test inbound_call_hangup_declined ... ok
2020-11-26T16:48:58.4718067Z test inbound_ice_connecting ... ok
2020-11-26T16:48:58.4725665Z test receive_expired_offer ... ok
2020-11-26T16:48:58.4738062Z test receive_expired_offer_after_age_limit ... ok
2020-11-26T16:48:58.4771026Z test receive_offer_at_age_limit ... ok
2020-11-26T16:48:58.4808827Z test receive_offer_before_age_limit ... ok
2020-11-26T16:48:58.5008238Z test receive_offer_while_active ... ok
2020-11-26T16:48:58.5042898Z 16:48:58 [ERROR] send_next_message(): closure failed Simulation: Intentional: Send answer failed
2020-11-26T16:48:58.5044078Z 16:48:58 [ERROR] send_next_message(): closure failed Simulation: Intentional: Send hangup failed
2020-11-26T16:48:58.5055025Z 16:48:58 [ERROR] Conclude call future failed: Simulation: Intentional: Close Media failed
2020-11-26T16:48:58.5059620Z test start_inbound_call_with_error ... ok
2020-11-26T16:48:58.5062814Z 
2020-11-26T16:48:58.5063384Z test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

This suggests the errors are probably triggered in start_inbound_call_with_error. Here's what can be found in that test:

// cause the sending of the answer to fail.
context.force_internal_fault(true);

The error is purposefully triggered to test the behavior in case this kind of error actually occurs. Throughout the test multiple assertions are made to check the behavior around this error, such as this:

// Two errors -- one from the failed send_answer and another from
// the failed send_hangup, sent as part of the error clean up.
assert_eq!(context.error_count(), 2);

The behavior was the same as the expected behavior, hence the test passed.

Thanks man! I missed it 👍