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

Admin*LogPageActionTest: improve stability #7829

Closed
whipermr5 opened this issue Jul 24, 2017 · 0 comments
Closed

Admin*LogPageActionTest: improve stability #7829

whipermr5 opened this issue Jul 24, 2017 · 0 comments
Assignees
Labels
a-Testing Testing-related traits such as efficiency, robustness, coverage p.Medium Marginal impact; would like to do if time permits
Milestone

Comments

@whipermr5
Copy link
Member

These two tests always fail during the first test try, and sometimes fail all the way through all the test tries. The issue is caused by TestNG running the many*Logs test groups in a separate thread from the typical*Logs test groups. This results in an error as the LocalUserService used in GaeSimulation is not thread safe and throws an error when it is called from different threads.

The root issue lies with TestNG not honouring the specified parallel settings when the priority flag is set in the @Test annotation. There is a bug in the before/after mechanism that breaks the parallel feature (testng-team/testng#1185).

Workaround: either set singleThreaded = true on the test classes or drop the use of priority.


Stack trace for AdminActivityLogPageActionTest:

java.lang.IllegalStateException: Operation not allowed in a thread that is neither the original request thread nor a thread created by ThreadManager
	at com.google.appengine.api.users.UserServiceImpl.getCurrentEnvironmentOrThrow(UserServiceImpl.java:152)
	at com.google.appengine.api.users.UserServiceImpl.getCurrentUser(UserServiceImpl.java:109)
	at teammates.logic.api.GateKeeper.getCurrentGoogleUser(GateKeeper.java:305)
	at teammates.logic.api.GateKeeper.getCurrentUser(GateKeeper.java:37)
	at teammates.ui.controller.Action.authenticateUser(Action.java:238)
	at teammates.ui.controller.Action.init(Action.java:98)
	at teammates.ui.controller.ActionFactory.getAction(ActionFactory.java:143)
	at teammates.test.driver.GaeSimulation.getActionObject(GaeSimulation.java:169)
	at teammates.test.cases.action.AdminActivityLogPageActionTest.getAction(AdminActivityLogPageActionTest.java:567)
	at teammates.test.cases.action.AdminActivityLogPageActionTest.statusMessageAndContinueSearch_withManyLogs_searchCorrectly(AdminActivityLogPageActionTest.java:390)
	...

Failed suite [Failed suite [Failed suite [ci-tests]]] > component-tests(failed)(failed)(failed) > teammates.test.cases.action.AdminActivityLogPageActionTest.statusMessageAndContinueSearch_withManyLogs_searchCorrectly FAILED
    java.lang.IllegalStateException at AdminActivityLogPageActionTest.java:567

Stack trace for AdminEmailLogPageActionTest:

java.lang.IllegalStateException: Operation not allowed in a thread that is neither the original request thread nor a thread created by ThreadManager
	at com.google.appengine.api.users.UserServiceImpl.getCurrentEnvironmentOrThrow(UserServiceImpl.java:152)
	at com.google.appengine.api.users.UserServiceImpl.getCurrentUser(UserServiceImpl.java:109)
	at teammates.logic.api.GateKeeper.getCurrentGoogleUser(GateKeeper.java:305)
	at teammates.logic.api.GateKeeper.getCurrentUser(GateKeeper.java:37)
	at teammates.ui.controller.Action.authenticateUser(Action.java:238)
	at teammates.ui.controller.Action.init(Action.java:98)
	at teammates.ui.controller.ActionFactory.getAction(ActionFactory.java:143)
	at teammates.test.driver.GaeSimulation.getActionObject(GaeSimulation.java:169)
	at teammates.test.cases.action.AdminEmailLogPageActionTest.getAction(AdminEmailLogPageActionTest.java:427)
	at teammates.test.cases.action.AdminEmailLogPageActionTest.statusMessageAndContinueSearch_withManyLogs_searchCorrectly(AdminEmailLogPageActionTest.java:291)
	...

Failed suite [Failed suite [Failed suite [ci-tests]]] > component-tests(failed)(failed)(failed) > teammates.test.cases.action.AdminEmailLogPageActionTest.statusMessageAndContinueSearch_withManyLogs_searchCorrectly FAILED
    java.lang.IllegalStateException at AdminEmailLogPageActionTest.java:427
@whipermr5 whipermr5 added a-Testing Testing-related traits such as efficiency, robustness, coverage p.Medium Marginal impact; would like to do if time permits labels Jul 24, 2017
@whipermr5 whipermr5 self-assigned this Jul 24, 2017
@whipermr5 whipermr5 added this to the V5.111 milestone Aug 29, 2017
@whipermr5 whipermr5 added the e.2 label Aug 29, 2017
@whipermr5 whipermr5 modified the milestones: V5.111, V5.112 Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-Testing Testing-related traits such as efficiency, robustness, coverage p.Medium Marginal impact; would like to do if time permits
Projects
None yet
Development

No branches or pull requests

1 participant