mirror of https://gitee.com/bigwinds/arangodb
Make error handling in move shard tests more robust. (#7418)
* Make getCleanedOutServers error handling more robust. * Fix two more instances of getCleanedOutServers.
This commit is contained in:
parent
cfe7c02a05
commit
7bf63cdb95
|
@ -119,11 +119,21 @@ function MovingShardsSuite () {
|
|||
} catch (err) {
|
||||
console.error(
|
||||
"Exception for POST /_admin/cluster/cleanOutServer:", err.stack);
|
||||
return {};
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
if (res.statusCode !== 200) {
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
var body = res.body;
|
||||
if (typeof body === "string") {
|
||||
body = JSON.parse(body);
|
||||
try {
|
||||
body = JSON.parse(body);
|
||||
} catch (err2) {
|
||||
}
|
||||
}
|
||||
if (typeof body !== "object" || !body.hasOwnProperty("cleanedServers") ||
|
||||
typeof body.cleanedServers !== "object") {
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
|
|
@ -174,11 +174,21 @@ function MovingShardsWithViewSuite (options) {
|
|||
} catch (err) {
|
||||
console.error(
|
||||
"Exception for POST /_admin/cluster/cleanOutServer:", err.stack);
|
||||
return {};
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
if (res.statusCode !== 200) {
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
var body = res.body;
|
||||
if (typeof body === "string") {
|
||||
body = JSON.parse(body);
|
||||
try {
|
||||
body = JSON.parse(body);
|
||||
} catch (err2) {
|
||||
}
|
||||
}
|
||||
if (typeof body !== "object" || !body.hasOwnProperty("cleanedServers") ||
|
||||
typeof body.cleanedServers !== "object") {
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
|
|
@ -250,15 +250,23 @@ describe('Shard distribution', function () {
|
|||
const envelope =
|
||||
{ method: "GET", url: url + "/_admin/cluster/numberOfServers" };
|
||||
let res = request(envelope);
|
||||
if (res.statusCode !== 200) {
|
||||
return {cleanedServers: []};
|
||||
}
|
||||
var body = res.body;
|
||||
if (typeof body === "string") {
|
||||
body = JSON.parse(body);
|
||||
}
|
||||
if (typeof body !== "object" ||
|
||||
!body.hasOwnProperty("cleanedServers") ||
|
||||
typeof body.cleanedServers !== "object") {
|
||||
return {cleanedServers:[]};
|
||||
}
|
||||
return body;
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"Exception for POST /_admin/cluster/cleanOutServer:", err.stack);
|
||||
return {};
|
||||
return {cleanedServers: []};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue