8000 Bugfix/cleanup graphs (#3250) · MohammedDeveloper/arangodb@2833bd6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2833bd6

Browse files
dothebartfceller
authored andcommitted
Bugfix/cleanup graphs (arangodb#3250)
* when running against an external server also setup the proper connection * cleanup grahs after testing
1 parent d541109 commit 2833bd6

File tree

6 files changed

+2590
-2699
lines changed

6 files changed

+2590
-2699
lines changed

js/client/modules/@arangodb/process-utils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,8 @@ function startInstanceSingleServer (instanceInfo, protocol, options,
11671167

11681168
function startInstance (protocol, options, addArgs, testname, tmpDir) {
11691169
let rootDir = fs.join(tmpDir || fs.getTempPath(), testname);
1170+
print("rootdir: " + rootDir + " = fs.join(tmpDir " + tmpDir);
1171+
11701172
let instanceInfo = {
11711173
rootDir,
11721174
arangods: []
@@ -1175,11 +1177,13 @@ function startInstance (protocol, options, addArgs, testname, tmpDir) {
11751177
const startTime = time();
11761178
try {
11771179
if (options.hasOwnProperty('server')) {
1178-
return { endpoint: options.server,
1180+
let rc = { endpoint: options.server,
11791181
rootDir: options.serverRoot,
11801182
url: options.server.replace('tcp', 'http'),
11811183
arangods: []
1182-
};
1184+
};
1185+
arango.reconnect(rc.endpoint, '_system', 'root', '');
1186+
return rc;
11831187
} else if (options.cluster) {
11841188
startInstanceCluster(instanceInfo, protocol, options,
11851189
addArgs, rootDir);
@@ -1239,7 +1243,6 @@ function startInstance (protocol, options, addArgs, testname, tmpDir) {
12391243
print(e, e.stack);
12401244
return false;
12411245
}
1242-
12431246
return instanceInfo;
12441247
}
12451248

js/client/modules/@arangodb/test-utils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ function performTests (options, testList, testname, runFn, serverOptions, startS
156156
let continueTesting = true;
157157
let count = 0;
158158
let forceTerminate = false;
159+
let graphCount = 0;
159160

160161
for (let i = 0; i < testList.length; i++) {
161162
let te = testList[i];
@@ -234,6 +235,17 @@ function performTests (options, testList, testname, runFn, serverOptions, startS
234235
});
235236
}
236237

238+
if (db._graphs.count() !== graphCount) {
239+
results[te] = {
240+
status: false,
241+
message: 'Cleanup of graphs missing - found graph definitions: [ ' +
242+
JSON.stringify(db._graphs.toArray()) +
243+
' ] - Original test status: ' +
244+
JSON.stringify(results[te])
245+
};
246+
graphCount = db._graphs.count();
247+
}
248+
237249
if (startStopHandlers !== undefined && startStopHandlers.hasOwnProperty('alive')) {
238250
customInstanceInfos['alive'] = startStopHandlers.alive(options,
239251
serverOptions,

js/client/modules/@arangodb/testsuites/rspec.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function rubyTests (options, ssl) {
118118

119119
let continueTesting = true;
120120
let filtered = {};
121-
let result = {};
121+
let results = {};
122122

123123
let args;
124124
let command;
@@ -158,6 +158,7 @@ function rubyTests (options, ssl) {
158158
};
159159

160160
let count = 0;
161+
let graphCount = 0;
161162
files = tu.splitBuckets(options, files);
162163

163164
for (let i = 0; i < files.length; i++) {
@@ -170,7 +171,7 @@ function rubyTests (options, ssl) {
170171
if (!continueTesting) {
171172
print('Skipping ' + te + ' server is gone.');
172173

173-
result[te] = {
174+
results[te] = {
174175
status: false,
175176
message: instanceInfo.exitStatus
176177
};
@@ -203,7 +204,7 @@ function rubyTests (options, ssl) {
203204
print('\n' + Date() + ' rspec trying', tfn, '...');
204205
const res = pu.executeAndWait(command, args, options, 'arangosh', instanceInfo.rootDir);
205206

206-
result[te] = {
207+
results[te] = {
207208
total: 0,
208209
failed: 0,
209210
status: res.status
@@ -217,15 +218,15 @@ function rubyTests (options, ssl) {
217218
}
218219

219220
for (let j = 0; j < jsonResult.examples.length; ++j) {
220-
result[te].failed += parseRspecJson(
221-
jsonResult.examples[j], result[te],
221+
results[te].failed += parseRspecJson(
222+
jsonResult.examples[j], results[te],
222223
jsonResult.summary.duration);
223224
}
224225

225-
result[te].duration = jsonResult.summary.duration;
226+
results[te].duration = jsonResult.summary.duration;
226227
} catch (x) {
227228
print('Failed to parse rspec result: ' + x);
228-
result[te]['complete_' + te] = res;
229+
results[te]['complete_' + te] = res;
229230

230231
if (res.status === false) {
231232
options.cleanup = false;
@@ -247,15 +248,26 @@ function rubyTests (options, ssl) {
247248
return (name[0] !== '_'); // exclude system collections from the comparison
248249
});
249250
if (delta.length !== 0) {
250-
result[te] = {
251+
results[te] = {
251252
status: false,
252-
message: 'Cleanup missing - test left over collections: ' + delta + '. Original test status: ' + JSON.stringify(result[te])
253+
message: 'Cleanup missing - test left over collections! [' + delta + '] - Original test status: ' + JSON.stringify(results[te])
253254
};
254255
collectionsBefore = [];
255256
db._collections().forEach(collection => {
256257
collectionsBefore.push(collection._name);
257258
});
258259
}
260+
261+
if (db._graphs.count() !== graphCount) {
262+
results[te] = {
263+
status: false,
264+
message: 'Cleanup of graphs missing - found graph definitions: [ ' +
265+
JSON.stringify(db._graphs.toArray()) +
266+
' ] - Original test status: ' +
267+
JSON.stringify(results[te])
268+
};
269+
graphCount = db._graphs.count();
270+
}
259271
}
260272
} else {
261273
if (options.extremeVerbosity) {
@@ -268,19 +280,19 @@ function rubyTests (options, ssl) {
268280
print('Shutting down...');
269281

270282
if (count === 0) {
271-
result['ALLTESTS'] = {
283+
results['ALLTESTS'] = {
272284
status: false,
273285
skipped: true
274286
};
275-
result.status = false;
287+
results.status = false;
276288
print(RED + 'No testcase matched the filter.' + RESET);
277289
}
278290

279291
fs.remove(tmpname);
280292
pu.shutdownInstance(instanceInfo, options);
281293
print('done.');
282294

283-
return result;
295+
return results;
284296
}
285297

286298
// //////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)
0