I have implemented handlers for mnesia system events like mnesia_overload, inconsistent_database and mnesia_fatal. Now I want to test these handlers. I can create events and send them manually but I prefer mnesia sends them because then the testcases will be more real and they can find my misunderstanding of mnesia system event documentation.
Is it possible to trigger these events artificially for test purposes?
One way to achieve
mnesia_overloadis by simultaneously writing into mnesia table with a huge traffic (can be simulated using table insertion inside aspawn-ed process) while setting-mnesia dump_log_write_thresholdparameter to a very low value.You may get message similar to the following on the stdout
** WARNING ** Mnesia is overloaded: {dump_log,write_threshold}.For
mnesia_fatal, you can try by deleting all files in the mnesia data directory.