Fixing flaky tests in combov2.comboctl.PumpIOTest. cmdCMDReadErrorWarningStatus and checkCMDHistoryDeltaRetrieval failed about 20% of time (run with @RepeatedTest(100)) since pumpIO.disconnect was send before processing last command was done.
This commit is contained in:
parent
946ea0bf33
commit
5c34184723
1 changed files with 6 additions and 3 deletions
|
@ -24,7 +24,8 @@ class TestBluetoothDevice(private val testComboIO: ComboIO) : BluetoothDevice(Di
|
|||
}
|
||||
|
||||
override fun disconnect() {
|
||||
frameParser.reset()
|
||||
// Synchronized rest so we don't interfere with pushing/parsing data into the frameParser.
|
||||
synchronized(frameParser) { frameParser.reset() }
|
||||
runBlocking {
|
||||
innerJob.cancelAndJoin()
|
||||
}
|
||||
|
@ -38,8 +39,10 @@ class TestBluetoothDevice(private val testComboIO: ComboIO) : BluetoothDevice(Di
|
|||
}
|
||||
|
||||
override fun blockingSend(dataToSend: List<Byte>) {
|
||||
frameParser.pushData(dataToSend)
|
||||
frameParser.parseFrame()?.let {
|
||||
synchronized(frameParser) {
|
||||
frameParser.pushData(dataToSend)
|
||||
frameParser.parseFrame()
|
||||
}?.let {
|
||||
runBlocking {
|
||||
innerScope.async {
|
||||
testComboIO.send(it)
|
||||
|
|
Loading…
Reference in a new issue