Rename Slave to Host

The role of a slave as a host for Factorio servers is not well reflected
in its name and has caused confusion among users.  Rename slave to host
to better reflect its role as a host of Factorio servers.
This commit is contained in:
Hornwitser committed 2023-02-22 15:30:51 +01:00
1 parent 70ad295a89
commit 6fc3abafd5
101 files changed
+1168 -1168

No files matched your search

+12 -12
View File
@@ -11,12 +11,12 @@ describe("lib/command", function() {
let testRole = { id: 28, name: "Test Role", description: "Test", permissions: [] };
let mockConnector = new mock.MockConnector();
mockConnector.on("send", function(message) {
if (message.type === "list_slaves_request") {
if (message.type === "list_hosts_request") {
this.emit("message", {
seq: 1, type: "list_slaves_response",
seq: 1, type: "list_hosts_response",
data: {
seq: message.seq,
list: [{ agent: "test", version: "0.1", id: 11, name: "Test Slave", connected: false }],
list: [{ agent: "test", version: "0.1", id: 11, name: "Test Host", connected: false }],
},
});
} else if (message.type === "list_instances_request") {
@@ -24,7 +24,7 @@ describe("lib/command", function() {
seq: 1, type: "list_instances_response",
data: {
seq: message.seq,
list: [{ id: 57, assigned_slave: 4, name: "Test Instance", status: "stopped" }],
list: [{ id: 57, assigned_host: 4, name: "Test Instance", status: "stopped" }],
},
});
} else if (message.type === "list_roles_request") {
@@ -39,21 +39,21 @@ describe("lib/command", function() {
});
let testControl = new mock.MockControl(mockConnector);
libLink.messages.listSlaves.attach(testControl);
libLink.messages.listHosts.attach(testControl);
libLink.messages.listInstances.attach(testControl);
libLink.messages.listRoles.attach(testControl);
describe("resolveSlave", function() {
describe("resolveHost", function() {
it("should pass an integer like string back", async function() {
assert.equal(await libCommand.resolveSlave(null, "123"), 123);
assert.equal(await libCommand.resolveHost(null, "123"), 123);
});
it("should resolve a slave name with the controller", async function() {
assert.equal(await libCommand.resolveSlave(testControl, "Test Slave"), 11);
it("should resolve a host name with the controller", async function() {
assert.equal(await libCommand.resolveHost(testControl, "Test Host"), 11);
});
it("should throw if slave is not found", async function() {
it("should throw if host is not found", async function() {
await assert.rejects(
libCommand.resolveSlave(testControl, "invalid"),
new libErrors.CommandError("No slave named invalid")
libCommand.resolveHost(testControl, "invalid"),
new libErrors.CommandError("No host named invalid")
);
});
});