Skip to content

Commit

Permalink
[YAML] Automatically add simulated clusters from the clusters directo…
Browse files Browse the repository at this point in the history
…ry into the list of clusters used for test generation instead of manually adding them one by one at the top of SimulatedClusters.js
  • Loading branch information
vivien-apple committed Jan 4, 2022
1 parent b0af6ba commit 18f36b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
*/

const { ensureClusters } = require('../ClustersHelper.js');
const { DelayCommands } = require('./TestDelayCommands.js');
const { LogCommands } = require('./TestLogCommands.js');

const SimulatedClusters = [
DelayCommands,
LogCommands,
];
const fs = require('fs');
const path = require('path');

let SimulatedClusters = [];
(async () => {
const simulatedClustersPath = path.join(__dirname, 'clusters');
const simulatedClustersFiles = await fs.promises.readdir(simulatedClustersPath);
SimulatedClusters = simulatedClustersFiles.map(filename => (require(path.join(simulatedClustersPath, filename))).cluster);
return SimulatedClusters;
})();

function getSimulatedCluster(clusterName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ const DelayCommands = {
//
// Module exports
//
exports.DelayCommands = DelayCommands;
exports.cluster = DelayCommands;
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ const LogCommands = {
//
// Module exports
//
exports.LogCommands = LogCommands;
exports.cluster = LogCommands;

0 comments on commit 18f36b6

Please sign in to comment.