private void notifyWmThreadUnderLock() {
    if (hasChanges) return;
    hasChanges = true;
    hasChangesCondition.signalAll();
  }
Adds a test event that's processed at the end of WM iteration.
This allows tests to wait for an iteration to finish without messing with the threading
logic (that is prone to races if we e.g. remember the state before and wait for it to change,
self-deadlocking when triggering things explicitly and calling a blocking API, and hanging
forever if we wait for "another iteration"). If addTestEvent is called after all the other
calls of interest, it is guaranteed that the events from those calls will be processed
fully when the future is triggered.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java