In integration tests, brokers and servers run in the same JVM. All of them share the same ThreadUsageResourceAccountant in a singleton in Tracing.java. This makes certain kinds of tests hard to write. For example:
Some tests use InterruptingAccountant. This class is useful to inject errors in the broker. However, it is not possible to inject errors in servers as the broker will error out first.
Couple of options are:
- Run a server in a different JVM. This is a major change in how tests have to be written. It will also make debug mode harder.
- Use dependency injection rather than a singleton to pass around an accountant object.