In #45339 we discovered a bug in the workflow of data frame transforms which should have been covered by tests. The tricky part here is that we can not simulate this in an integration tests. In order to cover this we need a mocked test environment where we can set breakpoints to test for certain conditions, similar to https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexing/AsyncTwoPhaseIndexerTests.java