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:
Hornwitser committed 2023-02-22 15:30:51 +01:00
1 parent 6ae4c8ef46
commit 70ad295a89
119 files changed
+1394 -1376

No files matched your search

+14 -12
View File
@@ -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`,
}
);
});