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 (#13299)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 27, 2022
1 parent faf6943 commit 1691052
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 1691052

Please sign in to comment.