Closed paulhoadley closed 10 years ago
Are there any chances these tests are running in parallel?
As we've subsequently discussed in email, no it's just a single test method. (Also, this is running within Eclipse—is there a way to set JUnit concurrency within Eclipse?) If you end up adding the locking mechanism you talked about elsewhere, I'll see if that has any effect, though presumably that would only help if parallel testing was the problem, and in this case it can't be, right?
I've reproduced it! I'm looking for a solution. I think the clue is in this log statement:
- Entity classDescription is not ERXEntityClassDescription: Login
- Entity classDescription is not ERXEntityClassDescription: User
- Entity classDescription is not ERXEntityClassDescription: UserRole
It appears only if the test throws the mentioned exception.
Great news Henrique. Let me know if there's anything I can do to help.
I've found the root cause of the problem. Unfortunately, its a bug in Project Wonder. I'm not sure I can do something on WOUnit to workaround this problem.
I've added a few log messages to ERXModel
and ERXModelGroup
classes. The numbers in parenthesis are the hash code value for each object.
1. Add model erprototypes (322185831) to the default model group
2. Add model Control (429231097) to the default model group
3. Add model Ident (817101240) to the default model group
4. Refuse to add duplicate model Control (689037010) to the default model group
5. Refuse to add duplicate model Ident (1413202446) to the default model group
6. Load attribute prototype named from model Ident (817101240)
7. Load attribute prototype named from model Control (429231097)
8. Load attribute prototype named from model Ident (1413202446)
Pay attention to lines 5 and 8. At line 5, the model group refuses to load the model Ident
with hash code 1413202446
because there's already one model Ident
loaded. However, an attribute prototype is loaded from the Ident
model 1413202446
at line 8 only if the test throws the mentioned exception. The line 8 doesn't appear when the test pass.
I have no idea why the prototype is loaded from the wrong model. In spite of that fact, I know how to fix the Wonder code to avoid the creation of duplicate models. I've created the pull request https://github.com/wocommunity/wonder/pull/551 as an attempt to solve this problem. Would you mind to try it?
I will test it out, yes. Give me a couple of days.
The ERXModelGroup
patch in wocommunity/wonder#551 completely fixes this issue for me.
I should have closed this back in March. The fix to ERXModelGroup
referred to above completely resolves this for me. (I just updated Wonder to 6.1.2 locally, which fixed these tests on partial entities for me, which reminded me to go close this issue. Sorry it stayed open so long, there was no need.)
This is similar to the issue I reported in #32 (in that it occurs with the exact same test I described there), but it's a different looking stack trace now.
I may have contributed to some confusion here, in that I pulled the test described in #32 from my test suite altogether, and then described a different partials-related problem (whereby attributes added by the augmented entities weren't being recognised as merged into the base entity) which was completely fixed in the recent 1.2.3 release.
What I'm seeing now is an
InvocationTargetException
trying to test the base class at the framework level. I'll reproduce here the code from #32, as it's the same:Worse, the problem is non-deterministic: sometimes this test will pass, sometimes it will fail. When it fails, this is the current stack trace:
Note that that is different to the stack trace in #32.
So, to re-iterate, 1.2.3 completely solves the initialisation-related issue with merging of properties down to the base class. But the problem of testing just the base classes seems to persist.
Henrique, I'm going to send you my framework and its tests out of band in the hope you can pinpoint the problem quickly.