Support Capture-backed Docker monitors
This commit is contained in:
1 parent
da8b230cec
commit
862ff15eef
14 files changed
+399
-33
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { DOCKER_TLS_URL, isDockerSocketUrl, isDockerTlsUrl } from "../../../src/utils/dockerHost.ts";
|
||||
import { DOCKER_TLS_URL, isCaptureDockerUrl, isDockerSocketUrl, isDockerTlsUrl } from "../../../src/utils/dockerHost.ts";
|
||||
|
||||
describe("isDockerTlsUrl", () => {
|
||||
it.each(["tcp://host", "tcp://host:2376", "https://host", "https://host:2377", "tcp://host/", "tcp://10.0.0.1:2376", " tcp://host "])(
|
||||
@@ -31,6 +31,22 @@ describe("isDockerTlsUrl", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("isCaptureDockerUrl", () => {
|
||||
it.each(["http://host:59232/api/v1/metrics/docker", "https://example.com/prefix/metrics/docker/?all=false"])("accepts %s", (url) => {
|
||||
expect(isCaptureDockerUrl(url)).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"https://host:2376",
|
||||
"tcp://host:2376/api/v1/metrics/docker",
|
||||
"https://example.com/api/v1/metrics/docker/containers",
|
||||
"https://example.com/?path=/metrics/docker",
|
||||
undefined,
|
||||
])("rejects %s", (url) => {
|
||||
expect(isCaptureDockerUrl(url)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isDockerSocketUrl", () => {
|
||||
it.each(["unix:///var/run/docker.sock", "/var/run/docker.sock", " /run/docker.sock "])("accepts %s", (url) => {
|
||||
expect(isDockerSocketUrl(url)).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user