mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
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:
1 parent
808eda0513
commit
ee9c200ebf
8 files changed
+247
-30
No files matched your search
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user