]> git.ipfire.org Git - thirdparty/asterisk.git/commit
app_voicemail: Properly reinitialize config after unit tests.
authorNaveen Albert <asterisk@phreaknet.org>
Thu, 29 Feb 2024 14:27:09 +0000 (09:27 -0500)
committerNaveen Albert <asterisk@phreaknet.org>
Wed, 6 Mar 2024 14:05:07 +0000 (14:05 +0000)
commit564d22acc6d1491e3adf7a742b232f2f38e2f574
tree2c057d6df21fcfb7d4ddbe7a3f8c8244d24fdec9
parent157dff87b33bc468273430f0aa51cda6bdb66e72
app_voicemail: Properly reinitialize config after unit tests.

Most app_voicemail unit tests were not properly cleaning up
after themselves after running. This led to test mailboxes
lingering around in the system. It also meant that if any
unit tests in app_voicemail that create mailboxes were executed
and the module was not unloaded/loaded again prior to running
the test_voicemail_vm_info unit test, Asterisk would segfault
due to an attempt to copy a NULL string.

The load_config test did actually have logic to reinitialize
the config after the test. However, this did not work in practice
since load_config() would not reload the config since voicemail.conf
had not changed during the test; thus, additional logic has been
added to ensure that voicemail.conf is truly reloaded, after any
unit tests which modify the users list.

This prevents the SEGV due to invalid mailboxes lingering around,
and also ensures that the system state is restored to what it was
prior to the tests running.

Resolves: #629
apps/app_voicemail.c