From 116a4448e3f54198ecbb09a2f33994ee9519da5f Mon Sep 17 00:00:00 2001 From: Andreas Streichardt Date: Wed, 10 Aug 2016 16:10:45 +0200 Subject: [PATCH] Streamline agency testing --- js/client/modules/@arangodb/testing.js | 73 +------------------------- js/client/tests/agency/agency-test.js | 9 ++-- 2 files changed, 8 insertions(+), 74 deletions(-) diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index 281c398bbf..d5097d2ac9 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -3762,80 +3762,11 @@ testFuncs.stress_locks = function (options) { testFuncs.agency = function (options) { findTests(); - - var saveAgency = options.agency; - var saveCluster = options.cluster; - + options.agency = true; options.cluster = false; - let instanceInfo = startInstance('tcp', options, {}, 'agency'); - - if (instanceInfo === false) { - return { - shell_client: { - status: false, - message: 'failed to start agency!' - } - }; - } - - let results = {}; - let filtered = {}; - let continueTesting = true; - - for (let i = 0; i < testsCases.agency.length; i++) { - let te = testsCases.agency[i]; - - if (filterTestcaseByOptions(te, options, filtered)) { - if (!continueTesting) { - print('Skipping, ' + te + ' server is gone.'); - - results[te] = { - status: false, - message: instanceInfo.exitStatus - }; - - instanceInfo.exitStatus = 'server is gone.'; - - break; - } - - let agencyServers = instanceInfo.arangods.map(arangod => { - return arangod.url; - }); - - print('\narangosh: Trying', te, '...'); - - const reply = runInArangosh(options, instanceInfo, te, { - 'flatCommands': agencyServers.join(' ') - }); - results[te] = reply; - - if (reply.status !== true) { - options.cleanup = false; - - if (!options.force) { - break; - } - } - - continueTesting = checkInstanceAlive(instanceInfo, options); - } else { - if (options.extremeVerbosity) { - print('Skipped ' + te + ' because of ' + filtered.filter); - } - } - } - - print('Shutting down...'); - shutdownInstance(instanceInfo, options); - print('done.'); - - options.agency = saveAgency; - options.cluster = saveCluster; - - return results; + return performTests(options, testsCases.agency, 'agency', createArangoshRunner()); }; // ////////////////////////////////////////////////////////////////////////////// diff --git a/js/client/tests/agency/agency-test.js b/js/client/tests/agency/agency-test.js index 1bb25de0cc..434cd6f31f 100644 --- a/js/client/tests/agency/agency-test.js +++ b/js/client/tests/agency/agency-test.js @@ -8,7 +8,7 @@ /// /// DISCLAIMER /// -/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// Copyright 2010-2016 triagens GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. @@ -25,11 +25,12 @@ /// Copyright holder is triAGENS GmbH, Cologne, Germany /// /// @author Max Neunhoeffer -/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +/// @author Copyright 2016, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// var jsunity = require("jsunity"); var wait = require("internal").wait; +const instanceInfo = JSON.parse(require('fs').read('instanceinfo.json')); //////////////////////////////////////////////////////////////////////////////// /// @brief test suite @@ -42,7 +43,9 @@ function agencyTestSuite () { /// @brief the agency servers //////////////////////////////////////////////////////////////////////////////// - var agencyServers = ARGUMENTS[0].split(" "); + var agencyServers = instanceInfo.arangods.map(arangod => { + return arangod.url; + }); var whoseTurn = 0; var request = require("@arangodb/request");