[mod_sofia] unit-tests: Give mod_sofia time to spin up profile threads on load. Remove some fst_requires().

This commit is contained in:
Andrey Volk 2022-07-26 01:47:27 +03:00 committed by GitHub
parent 1ce71d7a1f
commit c671ebcb88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -247,6 +247,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL)
FST_TEARDOWN_BEGIN()
{
switch_sleep(200 * 1000);
}
FST_TEARDOWN_END()
@ -681,15 +682,14 @@ skiptest:
fst_check(status == SWITCH_STATUS_SUCCESS);
/*test is considered PASSED if we get a session*/
if (!session) {
fst_requires(session);
fst_check(session);
if (session) {
switch_sleep(1000 * 1000);
channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(session);
}
switch_sleep(1000 * 1000);
channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(session);
switch_safe_free(to);
/* sipp should timeout, attempt kill, just in case.*/
kill_sipp();

View File

@ -34,6 +34,7 @@
#include "../mod_sofia.c"
static int timeout_sec = 10;
static switch_interval_time_t delay_start_ms = 5000;
FST_CORE_EX_BEGIN("./conf", SCF_VG | SCF_USE_SQL)
@ -41,6 +42,11 @@ FST_MODULE_BEGIN(mod_sofia, sofia)
FST_SETUP_BEGIN()
{
/* Give mod_sofia time to spinup profile threads */
if (delay_start_ms) {
switch_sleep(delay_start_ms * 1000);
delay_start_ms = 0;
}
}
FST_SETUP_END()
@ -108,7 +114,6 @@ FST_TEST_BEGIN(originate_test)
fst_check(status == SWITCH_STATUS_SUCCESS);
if (session) {
channel = switch_core_session_get_channel(session);
fst_requires(channel);
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(session);
switch_sleep(1 * 1000 * 1000);