[jboss-jira] [JBoss JIRA] (WFLY-11323) Fixing flaky test WritableServiceBasedNamingStoreTestCase.testPermissions

Brian Stansberry (Jira) issues at jboss.org
Fri Nov 9 21:21:00 EST 2018


    [ https://issues.jboss.org/browse/WFLY-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13659728#comment-13659728 ] 

Brian Stansberry commented on WFLY-11323:
-----------------------------------------

Here's the failure:

{code}
java.lang.ExceptionInInitializerError
	at org.jboss.as.naming.NamingContext.check(NamingContext.java:585)
	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)
	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
	at org.jboss.as.naming.SecurityHelper.performAction(SecurityHelper.java:168)
	at org.jboss.as.naming.SecurityHelper.access$000(SecurityHelper.java:51)
	at org.jboss.as.naming.SecurityHelper$1.call(SecurityHelper.java:117)
	at org.jboss.as.naming.SecurityHelper$4.run(SecurityHelper.java:213)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.jboss.as.naming.SecurityHelper.runWithSecurityManager(SecurityHelper.java:210)
	at org.jboss.as.naming.SecurityHelper.testActionWithPermission(SecurityHelper.java:114)
	at org.jboss.as.naming.WritableServiceBasedNamingStoreTestCase.testPermissions(WritableServiceBasedNamingStoreTestCase.java:263)
	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:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
	at java.security.AccessController.checkPermission(AccessController.java:884)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at java.lang.Class.checkMemberAccess(Class.java:2348)
	at java.lang.Class.getDeclaredField(Class.java:2067)
	at org.wildfly.security.manager.WildFlySecurityManager.<clinit>(WildFlySecurityManager.java:113)
	... 35 more
{code}

I believe the problem is WildFlySecurityManager.<clinit> is doing stuff that fails if it runs when the restricted permission scheme the test sets up is in effect.  The proposed fix works around this by doing a lookup call before that restricted scheme is put in place, which has the effect of causing the WildFlySecurityManager.<clinit> to run.

> Fixing flaky test WritableServiceBasedNamingStoreTestCase.testPermissions
> -------------------------------------------------------------------------
>
>                 Key: WFLY-11323
>                 URL: https://issues.jboss.org/browse/WFLY-11323
>             Project: WildFly
>          Issue Type: Bug
>          Components: Naming
>         Environment: Any
>            Reporter: ORD Testers
>            Priority: Minor
>
> testPermissions fails when run by itself even when there’s no bug in the code. 
> This test can be fixed by looking up the name before testActionWithPermission is called, as shown in the following pull request. 
> https://github.com/wildfly/wildfly/pull/11833
> Let me know if you want to discuss more.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)



More information about the jboss-jira mailing list