mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 07:33:12 +09:00
Add execCtl shortcut for clusterctl tests
Add execCtl which is a shortcut to execute node clusterctl with the test config set.
This commit is contained in:
1 parent
5e5a47ce02
commit
f08774bd4a
2 files changed
+28
-22
No files matched your search
@@ -69,6 +69,11 @@ async function exec(...args) {
|
||||
return await util.promisify(child_process.exec)(...args);
|
||||
}
|
||||
|
||||
async function execCtl(...args) {
|
||||
args[0] = `node clusterctl --config ${controlConfigPath} ${args[0]}`;
|
||||
return await exec(...args);
|
||||
}
|
||||
|
||||
async function sendRcon(instanceId, command) {
|
||||
let response = await link.messages.sendRcon.send(control, { instance_id: instanceId, command });
|
||||
return response.result;
|
||||
@@ -124,7 +129,7 @@ before(async function() {
|
||||
masterProcess = await spawn("master:", `node master --config ${masterConfigPath} run`, "All plugins loaded");
|
||||
|
||||
let createArgs = `--id 4 --name slave --generate-token --output ${slaveConfigPath}`;
|
||||
await exec(`node clusterctl --config ${controlConfigPath} slave create-config ${createArgs}`);
|
||||
await execCtl(`slave create-config ${createArgs}`);
|
||||
await exec(`node slave --config ${slaveConfigPath} config set slave.instances_directory ${instancesDir}`);
|
||||
|
||||
slaveProcess = await spawn("slave:", `node slave --config ${slaveConfigPath} run`, "SOCKET | received ready from master");
|
||||
@@ -162,6 +167,7 @@ module.exports = {
|
||||
slowTest,
|
||||
get,
|
||||
exec,
|
||||
execCtl,
|
||||
sendRcon,
|
||||
getControl,
|
||||
|
||||
|
||||
Reference in new issue
Block a user