mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
Rename Master to Controller
The role of the master server as the party controlling every part of the cluster is not well reflected in its name and has caused confusion among users on several occasions. Rename master to controller to better reflects its role.
This commit is contained in:
1 parent
6ae4c8ef46
commit
70ad295a89
119 files changed
+1394
-1376
No files matched your search
+14
-12
@@ -64,43 +64,45 @@ describe("lib/plugin_loader", function() {
|
||||
);
|
||||
});
|
||||
});
|
||||
describe("loadMasterPluginClass()", function() {
|
||||
describe("loadControllerPluginClass()", function() {
|
||||
let baseDir = path.join("temp", "test", "plugin");
|
||||
let missingClass = path.join(baseDir, "missing_class_plugin");
|
||||
let wrongParentClass = path.join(baseDir, "wrong_parent_class_plugin");
|
||||
before(async function() {
|
||||
async function writeEntrypoint(pluginPath, content) {
|
||||
await fs.outputFile(path.join(pluginPath, "master.js"), content);
|
||||
await fs.outputFile(path.join(pluginPath, "controller.js"), content);
|
||||
}
|
||||
|
||||
await writeEntrypoint(missingClass, "");
|
||||
await writeEntrypoint(wrongParentClass, "class MasterPlugin {}\n module.exports = { MasterPlugin };\n");
|
||||
await writeEntrypoint(
|
||||
wrongParentClass, "class ControllerPlugin {}\n module.exports = { ControllerPlugin };\n"
|
||||
);
|
||||
});
|
||||
it("should throw if class is missing from entrypoint", async function() {
|
||||
await assert.rejects(
|
||||
libPluginLoader.loadMasterPluginClass({
|
||||
libPluginLoader.loadControllerPluginClass({
|
||||
name: "test",
|
||||
masterEntrypoint: "master",
|
||||
controllerEntrypoint: "controller",
|
||||
requirePath: path.resolve(missingClass),
|
||||
}),
|
||||
{
|
||||
message:
|
||||
`PluginError: Expected ${path.resolve(missingClass, "master")} ` +
|
||||
"to export a class named MasterPlugin",
|
||||
`PluginError: Expected ${path.resolve(missingClass, "controller")} ` +
|
||||
"to export a class named ControllerPlugin",
|
||||
}
|
||||
);
|
||||
});
|
||||
it("should throw if class is not a subclass of BaseMasterPlugin", async function() {
|
||||
it("should throw if class is not a subclass of BaseControllerPlugin", async function() {
|
||||
await assert.rejects(
|
||||
libPluginLoader.loadMasterPluginClass({
|
||||
libPluginLoader.loadControllerPluginClass({
|
||||
name: "test",
|
||||
masterEntrypoint: "master",
|
||||
controllerEntrypoint: "controller",
|
||||
requirePath: path.resolve(wrongParentClass),
|
||||
}),
|
||||
{
|
||||
message:
|
||||
"PluginError: Expected MasterPlugin exported from " +
|
||||
`${path.resolve(wrongParentClass, "master")} to be a subclass of BaseMasterPlugin`,
|
||||
"PluginError: Expected ControllerPlugin exported from " +
|
||||
`${path.resolve(wrongParentClass, "controller")} to be a subclass of BaseControllerPlugin`,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user