Build error related to default cache in Studio
Can anyone help fix unit tests that broke due to the default cache fix in Studio? https://jira.nuxeo.com/browse/NXS-5101
I am trying to build a new marketplace package in which the only difference is the studio release (compared to the last package which was built successfully, in March 2019).
After much trial and error, I tried doing a “revert to commit” in studio which reverted to the last release that was part of a successful jenkins mp build. There is no difference in the custom java code. However, 39 unit tests fail.
The errors look like this:
invoke on features error [Holder [type=class com.custom.custom.core.test.PropertiesFeature], Holder [type=class org.nuxeo.ecm.core.test.CoreFeature], Holder [type=class org.nuxeo.ecm.core.test.TransactionalFeature], Holder [type=class org.nuxeo.runtime.test.runner.ContainerFeature], Holder [type=class org.nuxeo.runtime.test.runner.RuntimeFeature], Holder [type=class org.nuxeo.runtime.test.runner.RandomBug$Feature], Holder [type=class org.nuxeo.runtime.test.runner.ConditionalIgnoreRule$Feature], Holder [type=class org.nuxeo.runtime.test.runner.MDCFeature]]
How can I address these errors? Thanks. Lara
Replying back after working with Lara on this.
We found a solution was to add better handling for usage of a “Principal” type variable that calls the method “getName()” in one of our classes.
Before it checked the validity after calling “getName” when it should have been checked before the call. This was moved up to call a method for the Principal variable if it's valid, and return early if it's not ready to call it's “getName” method.
Once the conditional check was properly set in place, the unit tests that relied on this class worked.