[Unit-tests] Improve stability of some tests.

This commit is contained in:
Andrey Volk 2022-08-24 17:19:20 +03:00
parent 56fc995325
commit 23eeb4ae75
4 changed files with 24 additions and 6 deletions

View File

@ -146,7 +146,7 @@ FST_TEST_BEGIN(tts_time)
} while (status == SWITCH_STATUS_SUCCESS); } while (status == SWITCH_STATUS_SUCCESS);
fst_check(read = sample_rate / interval * 3); // samples of 3 second fst_check(read = sample_rate / interval * 3); // samples of 3 second
fst_check_duration(3000, 750); fst_check_duration(3000, 1000);
switch_core_speech_close(&sh, &flags); switch_core_speech_close(&sh, &flags);
} }
FST_TEST_END() FST_TEST_END()

View File

@ -1,12 +1,21 @@
#include <switch.h> #include <switch.h>
#include <test/switch_test.h> #include <test/switch_test.h>
int timeout_sec = 10;
switch_interval_time_t delay_start_ms = 5000;
FST_CORE_DB_BEGIN("./conf_test") FST_CORE_DB_BEGIN("./conf_test")
{ {
FST_SUITE_BEGIN(switch_hold) FST_SUITE_BEGIN(switch_hold)
{ {
FST_SETUP_BEGIN() 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_requires_module("mod_sofia"); fst_requires_module("mod_sofia");
fst_requires_module("mod_commands"); fst_requires_module("mod_commands");
} }
@ -23,7 +32,7 @@ FST_SUITE_BEGIN(switch_hold)
switch_status_t status; switch_status_t status;
switch_call_cause_t cause; switch_call_cause_t cause;
status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
fst_requires(session); fst_requires(session);
fst_check(status == SWITCH_STATUS_SUCCESS); fst_check(status == SWITCH_STATUS_SUCCESS);

View File

@ -482,7 +482,7 @@ FST_CORE_BEGIN("./conf")
switch_dial_handle_destroy(&dh); switch_dial_handle_destroy(&dh);
fst_check_duration(3000, 500); fst_check_duration(3000, 600);
} }
FST_TEST_END() FST_TEST_END()
@ -513,7 +513,7 @@ FST_CORE_BEGIN("./conf")
switch_dial_handle_destroy(&dh); switch_dial_handle_destroy(&dh);
fst_check_duration(3000, 500); fst_check_duration(3000, 600);
} }
FST_TEST_END() FST_TEST_END()

View File

@ -1,12 +1,21 @@
#include <switch.h> #include <switch.h>
#include <test/switch_test.h> #include <test/switch_test.h>
int timeout_sec = 10;
switch_interval_time_t delay_start_ms = 5000;
FST_CORE_DB_BEGIN("./conf_sip") FST_CORE_DB_BEGIN("./conf_sip")
{ {
FST_SUITE_BEGIN(switch_sip) FST_SUITE_BEGIN(switch_sip)
{ {
FST_SETUP_BEGIN() 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_requires_module("mod_sofia"); fst_requires_module("mod_sofia");
fst_requires_module("mod_hash"); fst_requires_module("mod_hash");
} }
@ -24,7 +33,7 @@ FST_SUITE_BEGIN(switch_sip)
const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>"; const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>";
char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data);
switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
switch_safe_free(originate_str); switch_safe_free(originate_str);
fst_requires(session); fst_requires(session);
@ -60,7 +69,7 @@ FST_SUITE_BEGIN(switch_sip)
const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>;alg=ES256;ppt=shaken"; const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>;alg=ES256;ppt=shaken";
char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data); char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data);
switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
switch_safe_free(originate_str); switch_safe_free(originate_str);
fst_requires(session); fst_requires(session);