mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Add limit and order to query log request
Add optional limit to the number of log records to return in the log query request to avoid having the web interface instance console download the entire log for only to show a few hundred lines from it. To make it possible to query the end of the log instead of just the start add an order option as well.
This commit is contained in:
1 parent
9aebeeac02
commit
e3d8aa1a9b
5 files changed
+53
-2
No files matched your search
@@ -62,6 +62,42 @@ describe("Integration of Clusterio", function() {
|
||||
await connectorB.close(1000, "");
|
||||
});
|
||||
});
|
||||
|
||||
describe("queryLogRequestHandler", function() {
|
||||
it("should honnor the limit", async function() {
|
||||
let result = await libLink.messages.queryLog.send(getControl(), {
|
||||
all: true,
|
||||
master: false,
|
||||
slave_ids: [],
|
||||
instance_ids: [],
|
||||
max_level: null,
|
||||
limit: 10,
|
||||
order: "asc",
|
||||
});
|
||||
assert.equal(result.log.length, 10);
|
||||
});
|
||||
it("should return entries by order", async function() {
|
||||
let first = await libLink.messages.queryLog.send(getControl(), {
|
||||
all: true,
|
||||
master: false,
|
||||
slave_ids: [],
|
||||
instance_ids: [],
|
||||
max_level: null,
|
||||
limit: 1,
|
||||
order: "asc",
|
||||
});
|
||||
let last = await libLink.messages.queryLog.send(getControl(), {
|
||||
all: true,
|
||||
master: false,
|
||||
slave_ids: [],
|
||||
instance_ids: [],
|
||||
max_level: null,
|
||||
limit: 1,
|
||||
order: "desc",
|
||||
});
|
||||
assert(first.log[0].timestamp < last.log[0].timestamp, "first log entry happened after last");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("clusterioslave", function() {
|
||||
|
||||
Reference in new issue
Block a user