| Summary: | Client tests failure in searchCrawler | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Mark Macdonald <mamacdon> |
| Component: | Client | Assignee: | libing wang <libingw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ahunter.eclipse, libingw, simon_kaegi |
| Version: | 5.0 | ||
| Target Milestone: | 6.0 M2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Looking at it now... fixed with patch below. Will push to master when it is opened.
diff --git a/bundles/org.eclipse.orion.client.ui/web/js-tests/searchCrawler/testcase.js b/bundles/org.eclipse.orion.client.ui/web/js-tests/searchCrawler/testcase.js
index 96f855b..c0f4512 100644
--- a/bundles/org.eclipse.orion.client.ui/web/js-tests/searchCrawler/testcase.js
+++ b/bundles/org.eclipse.orion.client.ui/web/js-tests/searchCrawler/testcase.js
@@ -667,6 +667,8 @@
keyword: "EveryWhere"
},
{location: "root"});
+ //There is time racing issue: if deferred.resolve is faster than deferred.cancel, then we need to tell the crawler teh mode is simulating.
+ crawler._simulating = true;
return _cancellAndCompare(crawler, 3, {
response: {
numFound: 3,
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/crawler/searchCrawler.js b/bundles/org.eclipse.orion.client.ui/web/orion/crawler/searchCrawler.js
index 755f3a7..5cf050e 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/crawler/searchCrawler.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/crawler/searchCrawler.js
@@ -60,16 +60,17 @@
this.contentTypesCache = ct;
var crawler = this;
this._visitRecursively(this._childrenLocation).then(function(){
- if(!crawler._cancelled) {
+ if(!crawler._cancelled || crawler._simulating){//If it is in simulating mode we need to report the result anyway
crawler._reportResult();
+ }
+ //Normally if a cancellation happens it goes to error handler. But in corner cases that deferred.resolve is faster than deferred.cancel we need to capture the case
+ if(crawler._cancelled) {
+ crawler._HandleStatus({name: "Cancel"}); //$NON-NLS-0$
}
}.bind(crawler),
function(error){
crawler._reportResult();
- if(crawler._statusService && error.name === "Cancel") { //$NON-NLS-0$
- console.log("Crawling search cancelled. Deferred array length : " + crawler._deferredArray.length); //$NON-NLS-0$
- crawler._statusService.setProgressResult({Message: messages["Search cancelled by user"], Severity: "Warning"}); //$NON-NLS-0$
- }
+ crawler._HandleStatus(error);
}.bind(crawler));
}.bind(this));
};
@@ -157,6 +158,13 @@
}.bind(this));
};
+ SearchCrawler.prototype._HandleStatus = function(error){
+ if(this._statusService && error.name === "Cancel") { //$NON-NLS-0$
+ console.log("Crawling search cancelled. Deferred array length : " + this._deferredArray.length); //$NON-NLS-0$
+ this._statusService.setProgressResult({Message: messages["Search cancelled by user"], Severity: "Warning"}); //$NON-NLS-0$
+ }
+ };
+
SearchCrawler.prototype._reportResult = function(){
this._sort(this.fileLocations);
var response = {numFound: this.fileLocations.length, docs: this.fileLocations };
pushed the fix into master with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e5ba5c73796c6d4f3f23411ef178702444ff0a3f Strange.. the test is still failing. For example it failed in last night's build (I20140331-2230) http://download.eclipse.org/orion/drops/I201403312230/Firefox-23.0-testResults.html#searchCrawler Hmm, strange. Will try it again locally. I downloaded FF 23 and tried the tests locally. The tests are successful. Will wait to see what tycho build result when Bug 431176 is fixed. Passing now |
Changes to deferred.js caused the cancellation test to fail. It has been like this for several weeks. It needs to be fixed. > Name Status Type > --------------------------------------------- > test_NormalCancel Failure Timed out