[MAGNOLIA-8193] Repository is not cleaned up post test execution Created: 30/Sep/21  Updated: 29/Oct/21  Resolved: 29/Oct/21

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0

Type: Bug Priority: Neutral
Reporter: Rishab Dhar Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by MAGNOLIA-7601 ClasspathResourcesUtil refactoring Closed
Relates
relates to BUILD-550 Java Technical update Selected
dependency
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: SaaS ITs

 Description   

On running the ITs in info.magnolia.sso.setup.SsoModuleVersionHandlerTest always the first test passes, but the second and third tests always fail with the below trace.

By the first looks of it, it seems like the resource imported for the first executed test still persists in the JCR repository which is preventing the subsequent tests from passing.

Running info.magnolia.sso.setup.SsoModuleVersionHandlerTest
2021-09-29 13:24:37,805 WARN  info.magnolia.module.InstallContextImpl           : [5/10 tasks - Magnolia SSO module (version 1.2.0-cloud-SNAPSHOT)]> sso-connector and magnolia-sso are incompatible modules, please remove the connector and its configuration before installing this one.
java.lang.RuntimeException: java.lang.RuntimeException: Error importing /mgnl-bootstrap/magnolia-sso/userroles.anonymous.acl_uri.01.yaml: This node already exists: /anonymous/acl_uri/1
        at info.magnolia.importexport.BootstrapUtil.bootstrap(BootstrapUtil.java:157)
        at info.magnolia.importexport.BootstrapUtil.bootstrap(BootstrapUtil.java:83)
        at info.magnolia.module.delta.BootstrapResourcesTask.bootstrap(BootstrapResourcesTask.java:82)
        at info.magnolia.module.delta.BootstrapResourcesTask.execute(BootstrapResourcesTask.java:74)
        at info.magnolia.module.ModuleManagerImpl.applyDeltas(ModuleManagerImpl.java:503)
        at info.magnolia.module.ModuleManagerImpl.installOrUpdateModule(ModuleManagerImpl.java:485)
        at info.magnolia.module.ModuleManagerImpl$1.doExec(ModuleManagerImpl.java:272)
        at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:407)
        at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:404)
        at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:378)
        at info.magnolia.module.ModuleManagerImpl.performInstallOrUpdate(ModuleManagerImpl.java:266)
        at info.magnolia.module.ModuleVersionHandlerTestCase.executeUpdatesAsIfTheCurrentlyInstalledVersionWas(ModuleVersionHandlerTestCase.java:288)
        at info.magnolia.sso.setup.SsoModuleVersionHandlerTest.freshInstallPutsTheSSOClientCallbackBeforeForm(SsoModuleVersionHandlerTest.java:103)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
        at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
        at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:212)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:208)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:171)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.executeNonConcurrentTasks(ForkJoinPoolHierarchicalTestExecutorService.java:141)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:121)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:171)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.executeNonConcurrentTasks(ForkJoinPoolHierarchicalTestExecutorService.java:141)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:121)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:171)
        at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: java.lang.RuntimeException: Error importing /mgnl-bootstrap/magnolia-sso/userroles.anonymous.acl_uri.01.yaml: This node already exists: /anonymous/acl_uri/1
        at info.magnolia.importexport.DataTransporter.importYamlStream(DataTransporter.java:480)
        at info.magnolia.importexport.command.JcrImportCommand.execute(JcrImportCommand.java:68)
        at info.magnolia.importexport.BootstrapUtil.bootstrap(BootstrapUtil.java:151)
        ... 71 more
Caused by: javax.jcr.ItemExistsException: This node already exists: /anonymous/acl_uri/1
        at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1299)
        at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:111)
        at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:37)
        at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
        at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
        at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:1818)
        at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1778)
        at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129)
        at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131)
        at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129)
        at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131)
        at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129)
        at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131)
        at info.magnolia.jcr.wrapper.MgnlPropertySettingNodeWrapper.addNode(MgnlPropertySettingNodeWrapper.java:210)
        at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129)
        at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131)
        at info.magnolia.audit.MgnlAuditLoggingContentDecoratorNodeWrapper.addNode(MgnlAuditLoggingContentDecoratorNodeWrapper.java:84)
        at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129)
        at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131)
        at info.magnolia.importexport.DataTransporter.yaml2Jcr(DataTransporter.java:778)
        at info.magnolia.importexport.DataTransporter.importYamlStream(DataTransporter.java:472)


 Comments   
Comment by Mikaël Geljić [ 29/Oct/21 ]

encountered different issue at first: PathNotFoundException (in SsoModuleVersionHandlerTest) because the magnolia-sso clientCallback was not bootstrapped (not found in test-resources, due to MAGNOLIA-7601 not being ported to 6.3-cloud version)

Comment by Mikaël Geljić [ 29/Oct/21 ]

initial issue cannot be reproduced atm

Comment by Rishab Dhar [ 29/Oct/21 ]

The issue is triggered when the test is migrated to JUnit 5. For now, the test is reverted back to Junit 4 as the effort to migrate the test framework is being tracked by DEV-1614

Generated at Mon Feb 12 04:30:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.