How to test mnesia system events

185 views Asked by At

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?

1

There are 1 answers

0
Agus On

One way to achieve mnesia_overload is by simultaneously writing into mnesia table with a huge traffic (can be simulated using table insertion inside a spawn-ed process) while setting-mnesia dump_log_write_threshold parameter 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.