Implement host plugins

Add ability to define plugin code that runs in the context of a host,
starts up with the host does, and stops when the host shuts down.
This commit is contained in:
Hornwitser committed 2023-11-25 19:18:33 +01:00
1 parent 808eda0513
commit ee9c200ebf
8 files changed
+247 -30

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
"use strict";
const assert = require("assert").strict;
const mock = require("../mock");
const host = require("@clusterio/host");
describe("host/src/BaseHostPlugin", function() {
describe("class BaseHostPlugin", function() {
let hostPlugin;
it("should be constructible", async function() {
hostPlugin = new host.BaseHostPlugin({}, new mock.MockHost(), new mock.MockLogger());
await hostPlugin.init();
});
it("should define defaults for hooks", async function() {
await hostPlugin.onHostConfigFieldChanged();
await hostPlugin.onMetrics();
await hostPlugin.onShutdown();
hostPlugin.onControllerConnectionEvent("connect");
await hostPlugin.onPrepareControllerDisconnect();
});
});
});