feat: 扩展共享 Prometheus 可观测性
This commit is contained in:
@@ -13,6 +13,8 @@ describe("platform-infra observability progressive disclosure", () => {
|
||||
expect(Buffer.byteLength(compact.renderedText, "utf8")).toBeLessThan(10_240);
|
||||
expect(compact.renderedText).toContain("serviceConnections=8");
|
||||
expect(compact.renderedText).toContain("configRefs=6/6 missing=0");
|
||||
expect(compact.renderedText).toContain("prometheus=true service=prometheus");
|
||||
expect(compact.renderedText).toContain("scrapeSelector=unidesk.ai/metrics=true");
|
||||
expect(compact.renderedText).toContain("--full");
|
||||
expect(compact.renderedText).toContain("--raw");
|
||||
|
||||
@@ -25,6 +27,7 @@ describe("platform-infra observability progressive disclosure", () => {
|
||||
renderPlan: { target: { id: "NC01", route: "NC01:k3s", namespace: "platform-infra" } },
|
||||
});
|
||||
expect((expanded as Record<string, any>).renderPlan.instrumentation).toHaveLength(8);
|
||||
expect((expanded as Record<string, any>).config.metricsBackend).toMatchObject({ type: "prometheus", enabled: true });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,8 +41,8 @@ describe("platform-infra observability progressive disclosure", () => {
|
||||
expect(result.stdout).not.toContain("/tmp/unidesk-cli-output");
|
||||
});
|
||||
|
||||
test("search, trace and diagnose-code-agent expose only scoped help", () => {
|
||||
for (const operation of ["search", "trace", "diagnose-code-agent"]) {
|
||||
test("query commands expose only scoped help", () => {
|
||||
for (const operation of ["search", "trace", "diagnose-code-agent", "metrics-query"]) {
|
||||
const result = cli(["platform-infra", "observability", operation, "--help"]);
|
||||
expect(result.status).toBe(0);
|
||||
const payload = JSON.parse(result.stdout) as Record<string, any>;
|
||||
@@ -57,7 +60,7 @@ describe("platform-infra observability progressive disclosure", () => {
|
||||
expect(result.status).toBe(0);
|
||||
const payload = JSON.parse(result.stdout) as Record<string, any>;
|
||||
expect(payload.data.operations.map((item: Record<string, unknown>) => item.name)).toEqual([
|
||||
"plan", "apply", "status", "validate", "trace", "search", "diagnose-code-agent",
|
||||
"plan", "apply", "status", "validate", "trace", "search", "diagnose-code-agent", "metrics-query",
|
||||
]);
|
||||
expect(payload.data.scopedHelp).toContain("<operation> --help");
|
||||
expect(payload.data.usage).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user