@creezio/observability 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -246,6 +246,70 @@ try {
|
|
|
246
246
|
assert.deepEqual(hosts.json.hosts, []);
|
|
247
247
|
assert.ok(hosts.json.refreshedAt, "refreshedAt attendu sur /hosts");
|
|
248
248
|
|
|
249
|
+
// agent up pousse l'URL dédiée (POST /admin/api/hosts/agent-url, pas de Basic).
|
|
250
|
+
const tok = await req(
|
|
251
|
+
"POST",
|
|
252
|
+
"/admin/api/hosts/enroll-token",
|
|
253
|
+
JSON.stringify({ label: "gate-agenturl" }),
|
|
254
|
+
{ Authorization: BASIC },
|
|
255
|
+
);
|
|
256
|
+
assert.equal(tok.status, 200);
|
|
257
|
+
assert.ok(tok.json.enrollToken);
|
|
258
|
+
const enroll = await req(
|
|
259
|
+
"POST",
|
|
260
|
+
"/admin/api/enroll",
|
|
261
|
+
JSON.stringify({
|
|
262
|
+
enrollToken: tok.json.enrollToken,
|
|
263
|
+
hostId: "host-gate",
|
|
264
|
+
label: "gate",
|
|
265
|
+
agentUrl: "https://agent.resto.example.test",
|
|
266
|
+
agentToken: "agent-tok-gate-1",
|
|
267
|
+
}),
|
|
268
|
+
);
|
|
269
|
+
assert.equal(enroll.status, 200, enroll.raw);
|
|
270
|
+
assert.equal(enroll.json.ok, true);
|
|
271
|
+
const pushUrl = await req(
|
|
272
|
+
"POST",
|
|
273
|
+
"/admin/api/hosts/agent-url",
|
|
274
|
+
JSON.stringify({
|
|
275
|
+
hostId: "host-gate",
|
|
276
|
+
agentUrl: "https://agent-resto.example.test/",
|
|
277
|
+
agentToken: "agent-tok-gate-1",
|
|
278
|
+
}),
|
|
279
|
+
);
|
|
280
|
+
assert.equal(pushUrl.status, 200, pushUrl.raw);
|
|
281
|
+
assert.equal(pushUrl.json.ok, true);
|
|
282
|
+
assert.equal(pushUrl.json.agentUrl, "https://agent-resto.example.test");
|
|
283
|
+
assert.equal(pushUrl.json.changed, true);
|
|
284
|
+
const hostsFile = JSON.parse(
|
|
285
|
+
fs.readFileSync(path.join(BRAND_ROOT, "docker-data", "fleet-hosts.json"), "utf8"),
|
|
286
|
+
);
|
|
287
|
+
assert.equal(
|
|
288
|
+
hostsFile.hosts[0].agentUrl,
|
|
289
|
+
"https://agent-resto.example.test",
|
|
290
|
+
"fleet-hosts.json : plus l'URL nested partagée",
|
|
291
|
+
);
|
|
292
|
+
const badTok = await req(
|
|
293
|
+
"POST",
|
|
294
|
+
"/admin/api/hosts/agent-url",
|
|
295
|
+
JSON.stringify({
|
|
296
|
+
hostId: "host-gate",
|
|
297
|
+
agentUrl: "https://agent-resto.example.test",
|
|
298
|
+
agentToken: "wrong",
|
|
299
|
+
}),
|
|
300
|
+
);
|
|
301
|
+
assert.equal(badTok.status, 401);
|
|
302
|
+
const noHttps = await req(
|
|
303
|
+
"POST",
|
|
304
|
+
"/admin/api/hosts/agent-url",
|
|
305
|
+
JSON.stringify({
|
|
306
|
+
hostId: "host-gate",
|
|
307
|
+
agentUrl: "http://agent-resto.example.test",
|
|
308
|
+
agentToken: "agent-tok-gate-1",
|
|
309
|
+
}),
|
|
310
|
+
);
|
|
311
|
+
assert.equal(noHttps.status, 400);
|
|
312
|
+
|
|
249
313
|
// Ops JSONL : événements parsés, lignes invalides ignorées.
|
|
250
314
|
const ops = await req(
|
|
251
315
|
"GET",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creezio/observability",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "Observabilité — activité/CP + ops/fleet + fleet-collector (P25) + usage analytics (N6) + request-logs admin (O5)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-cjs/index.js",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"test:api-endpoints": "node scripts/test-api-endpoints-registry.mjs"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@creezio/api-kernel": "^0.24.
|
|
42
|
-
"@creezio/fleet": "^0.24.
|
|
43
|
-
"@creezio/platform-core": "^0.24.
|
|
41
|
+
"@creezio/api-kernel": "^0.24.1",
|
|
42
|
+
"@creezio/fleet": "^0.24.1",
|
|
43
|
+
"@creezio/platform-core": "^0.24.1",
|
|
44
44
|
"hono": "^4.12.32"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|