Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests in ms-jacis and ms-sync are broken #5

Open
fullben opened this issue Apr 23, 2023 · 1 comment
Open

Tests in ms-jacis and ms-sync are broken #5

fullben opened this issue Apr 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@fullben
Copy link
Owner

fullben commented Apr 23, 2023

Observed Behavior

In version 2.1.1 of the benchmark, execution of any test in the ms-jacis and ms-sync subprojects fails with the error:

Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)

And root cause:

Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'embeddedStorageManager' defined in de.uniba.dsg.wss.service.MicroStreamTestConfiguration: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=microStreamTestConfiguration; factoryMethodName=embeddedStorageManager; initMethodName=null; destroyMethodName=(inferred); defined in de.uniba.dsg.wss.service.MicroStreamTestConfiguration] for bean 'embeddedStorageManager': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=msConfiguration; factoryMethodName=embeddedStorageManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [de/uniba/dsg/wss/MsConfiguration.class]] bound.

Expected Behavior

Tests should complete successfully :)

Analysis

As far as I can tell, the tests cannot be initialized since the default configuration of the actual applications in those subprojects has a default bean for the MicroStream EmbeddedStorageManager, being defined in the MsConfiguration classes of those projects and the tests attempt to create a bean with the same name in the MicroStreamTestConfiguration classes.

I don't really understand why this causes an exception, since in my understanding the @TestConfiguration annotation in the MicroStreamTestConfiguration classes should result in the storage manager beans defined in the MsConfiguration classes to be overridden by the storage manager beans defined in MicroStreamTestConfiguration classes.

I assume this is a test configuration issue. When looking into this issue, we should maybe also look into whether the @SpringBootTest annotation is the appropriate approach in these projects, this spins up a full application, with all the beans. Might be overkill.

@fullben fullben added the bug Something isn't working label Apr 23, 2023
@fullben fullben assigned fullben and unassigned fullben Apr 23, 2023
@fullben
Copy link
Owner Author

fullben commented Apr 23, 2023

@johannes-manner could you look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant