Path: blob/master/src/packages/project/kucalc.test.ts
1447 views
import * as kucalc from "./kucalc";12test("compute status is doing something", async () => {3const status = await kucalc.test_compute_status();4expect(new Set(Object.keys(status))).toEqual(5new Set([6"cpu",7"disk_MB",8"memory",9"oom_kills",10"processes",11"session_id",12"start_ts",13"time",14])15);16expect(status.memory.rss).toBeDefined();17});1819test("prometheus metric", async () => {20await kucalc.test_compute_status();21const project_id = "d9f0af23-6415-4df8-9888-84dbcaeee7f0";22const metrics = await kucalc.prometheus_metrics(project_id);23expect(metrics).toMatch(new RegExp(project_id));24expect(metrics).toMatch(/cocalc_project_memory_usage_ki/);25// check last character of metrics is a newline26expect(metrics[metrics.length - 1]).toBe("\n");27});282930