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
|
@ -24,7 +24,8 @@ class TestBluetoothDevice(private val testComboIO: ComboIO) : BluetoothDevice(Di
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect() {
|
override fun disconnect() {
|
||||||
frameParser.reset()
|
// Synchronized rest so we don't interfere with pushing/parsing data into the frameParser.
|
||||||
|
synchronized(frameParser) { frameParser.reset() }
|
||||||
runBlocking {
|
runBlocking {
|
||||||
innerJob.cancelAndJoin()
|
innerJob.cancelAndJoin()
|
||||||
}
|
}
|
||||||
|
@ -38,8 +39,10 @@ class TestBluetoothDevice(private val testComboIO: ComboIO) : BluetoothDevice(Di
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun blockingSend(dataToSend: List<Byte>) {
|
override fun blockingSend(dataToSend: List<Byte>) {
|
||||||
frameParser.pushData(dataToSend)
|
synchronized(frameParser) {
|
||||||
frameParser.parseFrame()?.let {
|
frameParser.pushData(dataToSend)
|
||||||
|
frameParser.parseFrame()
|
||||||
|
}?.let {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
innerScope.async {
|
innerScope.async {
|
||||||
testComboIO.send(it)
|
testComboIO.send(it)
|
||||||
|
|
Loading…
Reference in a new issue