Make KafkaDecoder tests run Lockstep to fix races
Converts the Kafka[Event/Histo]StreamDecoder tests to run in lockstep whenever possible. The previous version held the unit test for n number of Kafka steps then let both threads run free. This fixes numerous races resulting in flakey tests, for example is HistoStreamDecoder we waited for 1 iteration whereas three was required. Rather than just tweaking the values and hoping this new mechanism will deadlock if the threads get into a race-y condition. A timeout ensures that after 2 minutes we fail with an abort stating we deadlocked. This flushed out multiple races in the StreamDecoder too, however some tests which rely on the EndOfRunStream have to run unsyncronised: The the thread will block and the Kafka thread waits for ExtractData to be called, causing a deadlock. If we are having problems in the future that would be the first place to look, however for this commit it's out of scope.
Showing
- Framework/LiveData/CMakeLists.txt 2 additions, 1 deletionFramework/LiveData/CMakeLists.txt
- Framework/LiveData/inc/MantidLiveData/Kafka/IKafkaStreamDecoder.h 11 additions, 1 deletion...k/LiveData/inc/MantidLiveData/Kafka/IKafkaStreamDecoder.h
- Framework/LiveData/inc/MantidLiveData/Kafka/KafkaEventStreamDecoder.h 2 additions, 0 deletions...veData/inc/MantidLiveData/Kafka/KafkaEventStreamDecoder.h
- Framework/LiveData/inc/MantidLiveData/Kafka/KafkaHistoStreamDecoder.h 5 additions, 1 deletion...veData/inc/MantidLiveData/Kafka/KafkaHistoStreamDecoder.h
- Framework/LiveData/src/Kafka/IKafkaStreamDecoder.cpp 22 additions, 7 deletionsFramework/LiveData/src/Kafka/IKafkaStreamDecoder.cpp
- Framework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp 11 additions, 0 deletionsFramework/LiveData/src/Kafka/KafkaEventStreamDecoder.cpp
- Framework/LiveData/src/Kafka/KafkaHistoStreamDecoder.cpp 9 additions, 0 deletionsFramework/LiveData/src/Kafka/KafkaHistoStreamDecoder.cpp
- Framework/LiveData/test/CMakeLists.txt 1 addition, 0 deletionsFramework/LiveData/test/CMakeLists.txt
- Framework/LiveData/test/KafkaEventStreamDecoderTest.h 113 additions, 141 deletionsFramework/LiveData/test/KafkaEventStreamDecoderTest.h
- Framework/LiveData/test/KafkaHistoStreamDecoderTest.h 19 additions, 80 deletionsFramework/LiveData/test/KafkaHistoStreamDecoderTest.h
- Framework/LiveData/test/KafkaTestThreadHelper.h 143 additions, 0 deletionsFramework/LiveData/test/KafkaTestThreadHelper.h
Loading
Please register or sign in to comment