-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from boschglobal/feature-41
Run Integration Tests on GitHub Actions
- Loading branch information
Showing
7 changed files
with
135 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
While DataBrokerConnection#fetch and DataBrokerConnection#update are running synchronously the observers of the | ||
corresponding SubscriptionChannels run asynchronously. Between the update executed using #updateRandomXXXValue | ||
here and the propagation to the subscribed observers a small timeframe may pass. Therefore things like this most | ||
likely won't work because of the behavior described above: | ||
``` | ||
subscribe("Vehicle.Speed", observer) | ||
updateRandomFloatValue("Vehicle.Speed") | ||
verify { observer.onPropertyChanged("Vehicle.Speed", any())} | ||
``` | ||
|
||
Keep in mind, that when calling DataBrokerConnection#subscribe an initial update with the current value is send, | ||
to the subscribing observer, meaning that checking for a successful update requires at least two calls to the | ||
#onPropertyChanged method. One for the initial update and one for the consecutive, real update of the value. | ||
|
||
Using verify(timeout = 100\[, exactly = 1\]) alone won't fix this issue, because "exactly = 1" will always be | ||
fulfilled by the initial update mentioned above. It therefore needs to be something like | ||
verify(timeout = 100, exactly = 2) if an update is expected. | ||
|
||
A better example therefore would be: | ||
``` | ||
subscribe("Vehicle.Speed", observer) // triggers first #onPropertyChanged with initial value | ||
val value = updateRandomFloatValue() // triggers second #onPropertyChanged with updated value | ||
val dataEntries = mutableListOf<DataEntry>() | ||
verify (timeout = 100, exactly = 2) { // initial update + "updateRandomFloatValue") | ||
observer.onPropertyChanged("Vehicle.Speed", capture(dataEntries)) | ||
} | ||
val count = dataEntries.count { it.value.float == randomFloatValue } | ||
count shouldBe 1 | ||
``` |