mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Rename SystemMetrics to SystemInfo
There are more pieces of information about a system than just its CPU, Memory and disk metrics. To avoid having to build a separate collection and subscription for metrics and system info, rename the existing system metrics to system info in anticipation of providing additonal static system information such as CPU model in it.
This commit is contained in:
1 parent
5f25aad273
commit
4e36fa1b4e
14 files changed
+128
-128
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const { SystemInfo } = lib;
|
||||
|
||||
|
||||
describe("lib/data/ModPack", function() {
|
||||
describe("class SystemInfo", function() {
|
||||
it("correctly calculates derived metrics", function() {
|
||||
const system = new SystemInfo("controller", [0.5, 0.25, 0, 1], 1024, 768, 2048, 512, 0, false);
|
||||
assert.equal(system.cpuCapacity, 4);
|
||||
assert.equal(system.cpuUsed, 1.75);
|
||||
assert.equal(system.cpuAvailable, 2.25);
|
||||
assert.equal(system.cpuRatio, 0.4375);
|
||||
assert.equal(system.memoryUsed, 256);
|
||||
assert.equal(system.memoryRatio, 0.25);
|
||||
assert.equal(system.diskUsed, 1536);
|
||||
assert.equal(system.diskRatio, 0.75);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const { SystemMetrics } = lib;
|
||||
|
||||
|
||||
describe("lib/data/ModPack", function() {
|
||||
describe("class SystemMetrics", function() {
|
||||
it("correctly calculates derived metrics", function() {
|
||||
const metrics = new SystemMetrics("controller", [0.5, 0.25, 0, 1], 1024, 768, 2048, 512, 0, false);
|
||||
assert.equal(metrics.cpuCapacity, 4);
|
||||
assert.equal(metrics.cpuUsed, 1.75);
|
||||
assert.equal(metrics.cpuAvailable, 2.25);
|
||||
assert.equal(metrics.cpuRatio, 0.4375);
|
||||
assert.equal(metrics.memoryUsed, 256);
|
||||
assert.equal(metrics.memoryRatio, 0.25);
|
||||
assert.equal(metrics.diskUsed, 1536);
|
||||
assert.equal(metrics.diskRatio, 0.75);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user