feat(elasticsearch): allow disabling connectivity checks
This commit is contained in:
1 parent
be3336c1ec
commit
cce36ae058
12 files changed
+202
-10
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildElasticsearchExternalConfig, elasticsearchConnectivityCheckDisabledFromConfig } from "@/lib/connection/elasticsearchKibanaProxy";
|
||||
|
||||
describe("Elasticsearch connectivity-check configuration", () => {
|
||||
it.each([true, "true", "TRUE", "1", "yes", "YES", "on", "ON"])("reads enabled value %j", (value) => {
|
||||
expect(elasticsearchConnectivityCheckDisabledFromConfig({ connectivityCheckDisabled: value })).toBe(true);
|
||||
});
|
||||
|
||||
it.each([false, "false", "0", "no", "off", "", 1, null])("rejects disabled value %j", (value) => {
|
||||
expect(elasticsearchConnectivityCheckDisabledFromConfig({ connectivityCheckDisabled: value })).toBe(false);
|
||||
});
|
||||
|
||||
it("normalizes a legacy string flag when an edited connection is saved", () => {
|
||||
const disabled = elasticsearchConnectivityCheckDisabledFromConfig({ connectivityCheckDisabled: " yes " });
|
||||
const saved = buildElasticsearchExternalConfig("direct", "", "", "", disabled);
|
||||
|
||||
expect(saved).toEqual({ connectivityCheckDisabled: true });
|
||||
expect(elasticsearchConnectivityCheckDisabledFromConfig(saved)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user