Closed Inventitech closed 8 years ago
All of these 4 intervals are registered correctly on the server.
Apparently, this only happens for Eclipse projects. I've sampled a few Eclipse and IntelliJ projects which have test execution intervals on server and only Eclipse reports are missing this. IntelliJ reports look ok.
Thanks for investigating this, @levaja. It is a relieve to hear nothing is lost. I'll take it from here.
I've found the error, it's my fault. I will report here as soon as I come up with a solution for plugin, as well as for database cleanup (although you will probably have to execute the command on server).
In short, the error is in the fields' names (full names instead of abbreviations). We got "parent" instead of "p", "childrenExecutions" instead of "c" etc.
"testExecution" : { "projectHash" : "23812046aa94d58224f0ea1309f557dbaf1eee6a", "result" : "F", "duration" : 1.496000051498413, "childrenExecutions" : [ { "testClassHash" : "914ece8cee76a984575a0c0f1176c27272b19be8Test", "result" : "F", "duration" : 1.496000051498413, "childrenExecutions" : [ { "testMethodHash" : "37d714acabf8794974145e3990ae377480b55b32", "result" : "F", "duration" : 1.496000051498413 } ] } ] }
This first happened with IntelliJ intervals, I thought I fixed this. The issue occurs after dividing plugins into Core and Plugins - name serialization does not propagate correctly through 2 projects (Plugin+Core). I will check what went wrong and try to apply the same solution as in IntelliJ.
Considering the database, $rename command will certainly do the job. I will follow up on this later.
Okay, ignore the previous code because it only fixes about 90% of the intervals. The following code, I'm quite sure, will fix all of them:
Function that iterates through the single interval recursively:
db.system.js.save({_id:"Recursion", value: function recursion (c) {
if(c != null) {
if(c.duration != null) {
c.d = c.duration;
delete c.duration;}
if(c.projectHash != null) {
c.p = c.projectHash;
delete c.projectHash;}
if(c.result != null) {
c.r = c.result;
delete c.result;}
if(c.testClassHash != null) {
c.t = c.testClassHash;
delete c.testClassHash;}
if(c.testMethodHash != null) {
c.m = c.testMethodHash;
delete c.testMethodHash;}
if(c.childrenExecutions != null) {
c.c = c.childrenExecutions;
delete c.childrenExecutions;
for(var i = 0; i < c.c.length; i++) {
var a = recursion(c.c[i]);}}}}
});
Function that fixes a single interval:
db.system.js.save({_id:"FixIntervals", value: function(item) {
if(item.testExecution != null) {
item.je = item.testExecution;
delete item.testExecution;}
b = Recursion(item.je);
db.intervals.update({_id: item._id}, item);
}});
The first 2 functions will be saved on server, so it's necessary to load them with: db.loadServerScripts();
Command to execute:
db.intervals.find({"testExecution":{$exists:true}}).forEach(FixIntervals);
The code on my laptop executes in few seconds (with the whole database), so it should be fast on the server as well.
I've manually checked the intervals and I believe that this will fix this issue. Once again, I'm sorry for causing this one.
Igor, can I delete https://github.com/TestRoots/watchdog/issues/204#issuecomment-154209073 and https://github.com/TestRoots/watchdog/issues/204#issuecomment-154146269 so that we do not get confused when doing this?
Deleted :)
> db.intervals.count({"testExecution":{$exists:true}}); 9175
and after executing it:
> db.intervals.count({"testExecution":{$exists:true}}); 0
> db.intervals.count({"je":{$exists:true}}); 70944
That seems to have worked; excellent. Thanks!
I just hope nobody is using this ancient WD-version anymore ...
This needs to be done on an on-going basis, as there are still people using WD-1.5.
In the statistics in the Eclipse IDE, these executions are reported. I executed tests 4 times.
http://testroots.org/reports/project/75830647b4bc18c7c6f5a0cc5df2b7b3eaac2413.html