From d1a6add6ab3df9407af82aa149a886912106fbbc Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 5 Apr 2017 09:48:07 +0200 Subject: [PATCH] move replication & js http api tests into more intuitive locations --- js/client/modules/@arangodb/testsuites/aql.js | 31 ------------------- .../@arangodb/testsuites/replication.js | 22 +++++++++++-- .../modules/@arangodb/testsuites/rspec.js | 18 +++++++++-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/js/client/modules/@arangodb/testsuites/aql.js b/js/client/modules/@arangodb/testsuites/aql.js index 7a5c758040..0b8eea46f3 100644 --- a/js/client/modules/@arangodb/testsuites/aql.js +++ b/js/client/modules/@arangodb/testsuites/aql.js @@ -26,9 +26,7 @@ // ////////////////////////////////////////////////////////////////////////////// const functionsDocumentation = { - 'server_http': 'http server tests in Mocha', 'shell_client': 'shell client tests', - 'shell_replication': 'shell replication tests', 'shell_server': 'shell server tests', 'shell_server_aql': 'AQL tests in the server', 'shell_server_only': 'server specific tests' @@ -40,22 +38,6 @@ const optionsDocumentation = [ const _ = require('lodash'); const tu = require('@arangodb/test-utils'); -const pu = require('@arangodb/process-utils'); - -// ////////////////////////////////////////////////////////////////////////////// -// / @brief TEST: shell_replication -// ////////////////////////////////////////////////////////////////////////////// - -function shellReplication (options) { - let testCases = tu.scanTestPath('js/common/tests/replication'); - - var opts = { - 'replication': true - }; - _.defaults(opts, options); - - return tu.performTests(opts, testCases, 'shell_replication', tu.runThere); -} // ////////////////////////////////////////////////////////////////////////////// // / @brief TEST: shell_client @@ -68,16 +50,6 @@ function shellClient (options) { return tu.performTests(options, testCases, 'shell_client', tu.runInArangosh); } -// ////////////////////////////////////////////////////////////////////////////// -// / @brief TEST: shell_http -// ////////////////////////////////////////////////////////////////////////////// - -function serverHttp (options) { - let testCases = tu.scanTestPath('js/common/tests/http'); - - return tu.performTests(options, testCases, 'server_http', tu.runThere); -} - // ////////////////////////////////////////////////////////////////////////////// // / @brief TEST: shell_server // ////////////////////////////////////////////////////////////////////////////// @@ -131,14 +103,11 @@ function shellServerAql (options) { } function setup (testFns, defaultFns, opts, fnDocs, optionsDoc) { - testFns['shell_replication'] = shellReplication; testFns['shell_client'] = shellClient; - testFns['server_http'] = serverHttp; testFns['shell_server'] = shellServer; testFns['shell_server_aql'] = shellServerAql; testFns['shell_server_only'] = shellServerOnly; - defaultFns.push('server_http'); defaultFns.push('shell_client'); defaultFns.push('shell_server'); defaultFns.push('shell_server_aql'); diff --git a/js/client/modules/@arangodb/testsuites/replication.js b/js/client/modules/@arangodb/testsuites/replication.js index 9e41e7424c..ab33e22b78 100644 --- a/js/client/modules/@arangodb/testsuites/replication.js +++ b/js/client/modules/@arangodb/testsuites/replication.js @@ -28,14 +28,31 @@ const functionsDocumentation = { 'replication_ongoing': 'replication ongoing tests', 'replication_static': 'replication static tests', - 'replication_sync': 'replication sync tests' + 'replication_sync': 'replication sync tests', + 'shell_replication': 'shell replication tests' }; const optionsDocumentation = [ ]; +const _ = require('lodash'); const pu = require('@arangodb/process-utils'); const tu = require('@arangodb/test-utils'); +// ////////////////////////////////////////////////////////////////////////////// +// / @brief TEST: shell_replication +// ////////////////////////////////////////////////////////////////////////////// + +function shellReplication (options) { + let testCases = tu.scanTestPath('js/common/tests/replication'); + + var opts = { + 'replication': true + }; + _.defaults(opts, options); + + return tu.performTests(opts, testCases, 'shell_replication', tu.runThere); +} + // ////////////////////////////////////////////////////////////////////////////// // / @brief TEST: replication_ongoing // ////////////////////////////////////////////////////////////////////////////// @@ -141,7 +158,7 @@ function replicationStatic (options) { customInstanceInfos, startStopHandlers) { pu.shutdownInstance(customInstanceInfos.preStart.instanceInfo, options); - + return {}; } }; @@ -222,6 +239,7 @@ function replicationSync (options) { } function setup (testFns, defaultFns, opts, fnDocs, optionsDoc) { + testFns['shell_replication'] = shellReplication; testFns['replication_ongoing'] = replicationOngoing; testFns['replication_static'] = replicationStatic; testFns['replication_sync'] = replicationSync; diff --git a/js/client/modules/@arangodb/testsuites/rspec.js b/js/client/modules/@arangodb/testsuites/rspec.js index a0924a3b87..d73ee9f28c 100644 --- a/js/client/modules/@arangodb/testsuites/rspec.js +++ b/js/client/modules/@arangodb/testsuites/rspec.js @@ -26,6 +26,7 @@ // ////////////////////////////////////////////////////////////////////////////// const functionsDocumentation = { + 'server_http': 'http server tests in Mocha', 'http_replication': 'http replication tests', 'http_server': 'http server tests in Ruby', 'ssl_server': 'https server tests' @@ -50,6 +51,17 @@ const RED = require('internal').COLORS.COLOR_RED; const RESET = require('internal').COLORS.COLOR_RESET; // const YELLOW = require('internal').COLORS.COLOR_YELLOW; +// ////////////////////////////////////////////////////////////////////////////// +// / @brief TEST: shell_http +// ////////////////////////////////////////////////////////////////////////////// + +function serverHttp (options) { + // first starts to replace rspec: + let testCases = tu.scanTestPath('js/common/tests/http'); + + return tu.performTests(options, testCases, 'server_http', tu.runThere); +} + // ////////////////////////////////////////////////////////////////////////////// // / @brief runs ruby tests using RSPEC // ////////////////////////////////////////////////////////////////////////////// @@ -282,14 +294,16 @@ function sslServer (options) { function setup (testFns, defaultFns, opts, fnDocs, optionsDoc) { testFns['http_replication'] = httpReplication; testFns['http_server'] = httpServer; + testFns['server_http'] = serverHttp; testFns['ssl_server'] = sslServer; + defaultFns.push('server_http'); defaultFns.push('http_server'); defaultFns.push('ssl_server'); - opts['skipSsl'] = false; + opts['skipSsl'] = false; opts['rspec'] = 'rspec'; - opts['ruby'] = ''; + opts['ruby'] = ''; for (var attrname in functionsDocumentation) { fnDocs[attrname] = functionsDocumentation[attrname]; } for (var i = 0; i < optionsDocumentation.length; i++) { optionsDoc.push(optionsDocumentation[i]); }