]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] unit-tests: Give mod_sofia time to spin up profile threads on load. Remov...
authorAndrey Volk <andywolk@gmail.com>
Mon, 25 Jul 2022 22:47:27 +0000 (01:47 +0300)
committerGitHub <noreply@github.com>
Mon, 25 Jul 2022 22:47:27 +0000 (01:47 +0300)
src/mod/endpoints/mod_sofia/test/sipp-based-tests.c
src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c

index 33259f043f5e0c96f2522e83fe19f064a0c4c7f2..52c7c2f66cb50b65fc7d87e9d3bdbca35aab6391 100644 (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();
index 7ea194f6e4eb107f903042f0e1527f824902f076..dbc75390d40ffbde25386a4d40dff0e641334c85 100644 (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);