[MDSAL-393] Revise AbstractConcurrentDataBrokerTest design Created: 15/Nov/18 Updated: 09/Jan/24 |
|
| Status: | Confirmed |
| Project: | mdsal |
| Component/s: | Binding runtime |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The design of AbstractConcurrentDataBrokerTest constructor is very misleading, as "single threaded executor" is in fact directExecutor(). There is no provision for controlling timing of delivered DTCLs and users are not guided towards a proper alternative. This is highly misleading, as users doing integration tests with predictable DTCL delivery use directExecutor(), which ties together producers and consumers - hence deadlocking and users are lead to believe there is something from in their code. A replacement should really have two favors:
|
| Comments |
| Comment by Michael Vorburger [ 29/Jan/19 ] |
|
> The design of AbstractConcurrentDataBrokerTest constructor is very misleading, as "single threaded executor" is in fact directExecutor(). The (protected) constructor which takes a boolean useMTDataTreeChangeListenerExecutor argument lets tests chose to use an Executors.newCachedThreadPool() intead of a newDirectExecutorService (via ConcurrentDataBrokerTestCustomizer). > A replacement should really have two favors: IMHO users doing integration tests in the future should not use AbstractConcurrentDataBrokerTest at all anymore, but the Guice Modules hopefully upcoming in > postpone DTCLs and allow the test to deliver them as needed (all or one by one) That would be cool. PS: More of an FYI, but "component" integration tests which I was trying to promote 1-2 years ago have never really fully taken off; folks seem to prefer CSIT. |
| Comment by Robert Varga [ 29/Jan/19 ] |
|
CachedThreadPool does not allow control over when messages are delivered, leading to Thread.sleep() in tests. The use of directExecutor is completely bad, as it makes people there are producer/consumer deadlocks due to the coupling introduced by that executor – and not realizing this, they code up workarounds and needlessly complicate their code. Tying testing to a particular DI framework is not a good idea, I think, because Guice took quite a while to be usable with Java 11 – we do not want to get blocked again on such a think. And as for usage – depends where you look. BGPCEP is full of component integration tests. |
| Comment by Robert Varga [ 11/Dec/19 ] |
|
Having prototyped this a bit, I think we want to move away from 'AbstractTest' pattern to a 'TestKit' pattern, where the required functionality would be exposed as a utility class from which the users do not inherit. This has couple of advantages:
|