vaadin / quarkus

An extension to Quarkus to support Vaadin Flow
Apache License 2.0
28 stars 3 forks source link

UIScope tests are failing against Quarkus 3.x snaphost #131

Closed mcollovati closed 1 year ago

mcollovati commented 1 year ago

Tests are failing with AmbiguousResolution, probably meaning that more than one bean candidate is found for injection. This seems like a bug in the implementation of UIScope, mostly related to some changes on Quarkus 3.x

Error:  Errors: 
Error:    UiContextTest>AbstractContextTest.destroyAllActive_beanExistsInContext_beanDestroyed:36 » AmbiguousResolution
Error:    UiContextTest>AbstractContextTest.destroyAllActive_severalContexts_beanDestroyed:47 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.destroyContext_beanExistsInContext_beanDestroyed:136->InjectableContextTest.destroyContext_beanExistsInContext_beanDestroyed:195 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.destroyQuarkusContext_beanExistsInContext_beanDestroyed:154 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.destroy_beanExistsInContext_beanDestroyed:143 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.getState_beanExistsInContext_contextualInstanceAndBeanAreReturned:165 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.get_newContextActive_newBeanCreated:118 » AmbiguousResolution
Error:    UiContextTest>InjectableContextTest.get_sameContextActive_beanCreatedOnce:101 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.destroyContext_beanExistsInContext_beanDestroyed:136->InjectableContextTest.destroyContext_beanExistsInContext_beanDestroyed:195 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.destroyQuarkusContext_beanExistsInContext_beanDestroyed:154 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.destroy_beanExistsInContext_beanDestroyed:143 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.getState_beanExistsInContext_contextualInstanceAndBeanAreReturned:165 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.get_newContextActive_newBeanCreated:118 » AmbiguousResolution
Error:    UiPseudoScopeContextTest>InjectableContextTest.get_sameContextActive_beanCreatedOnce:101 » AmbiguousResolution

Potential related changes introduced in Quarkus since the last successful build

image

mcollovati commented 1 year ago

This is the commit that produces the failure on our side https://github.com/quarkusio/quarkus/commit/087b2c43fbab9b2ecbe53920ef8e308700ab3c95

With this commit, ArC treats additional bean defining annotations that are meta-annotated @Scope or @NormalScope as scope annotations, even if there is no corresponding context. This commit also fixes the type discovery implementations to also discover scope annotations and register them as additional bean defining annotations.

The test defines a UIContextTest.TestContextualStorageManager > UIScopedContext.ContextualStorageManager bean, but now also UIScopedContext.ContextualStorageManager is discovered as a bean because it is annotated with @VaadinSessionScoped, even if that scope is not registered for the test.

So, two beans of the same type UIScopedContext.ContextualStorageManager are discovered during test execution, causing the AmbiguousResolutionException.

This seems not an issue in the extension, but a misconfiguration of the test after Quarkus changes.