Remove the enableGhecDr flag
This commit is contained in:
Родитель
2208b42485
Коммит
673ea13af8
|
@ -680,11 +680,6 @@ export function getVariantAnalysisDefaultResultsSort(): SortKey {
|
|||
*/
|
||||
const ACTION_BRANCH = new Setting("actionBranch", VARIANT_ANALYSIS_SETTING);
|
||||
|
||||
export const VARIANT_ANALYSIS_ENABLE_GHEC_DR = new Setting(
|
||||
"enableGhecDr",
|
||||
VARIANT_ANALYSIS_SETTING,
|
||||
);
|
||||
|
||||
export function getActionBranch(): string {
|
||||
return ACTION_BRANCH.getValue<string>() || "main";
|
||||
}
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
import {
|
||||
VARIANT_ANALYSIS_ENABLE_GHEC_DR,
|
||||
hasEnterpriseUri,
|
||||
hasGhecDrUri,
|
||||
} from "../config";
|
||||
import { hasEnterpriseUri, hasGhecDrUri } from "../config";
|
||||
|
||||
/**
|
||||
* Determines whether MRVA should be enabled or not for the current GitHub host.
|
||||
* MRVA is enabled on github.com and GHEC-DR.
|
||||
* This is based on the `github-enterprise.uri` setting.
|
||||
*/
|
||||
export function isVariantAnalysisEnabledForGitHubHost(): boolean {
|
||||
return (
|
||||
// MRVA is always enabled on github.com
|
||||
!hasEnterpriseUri() ||
|
||||
// MRVA can be enabled on GHEC-DR using a feature flag
|
||||
(hasGhecDrUri() && !!VARIANT_ANALYSIS_ENABLE_GHEC_DR.getValue<boolean>())
|
||||
);
|
||||
return !hasEnterpriseUri() || hasGhecDrUri();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
import { ConfigurationTarget } from "vscode";
|
||||
import {
|
||||
VARIANT_ANALYSIS_ENABLE_GHEC_DR,
|
||||
VSCODE_GITHUB_ENTERPRISE_URI_SETTING,
|
||||
} from "../../../../src/config";
|
||||
import { VSCODE_GITHUB_ENTERPRISE_URI_SETTING } from "../../../../src/config";
|
||||
import { isVariantAnalysisEnabledForGitHubHost } from "../../../../src/variant-analysis/ghec-dr";
|
||||
|
||||
describe("checkVariantAnalysisEnabled", () => {
|
||||
it("returns cleanly when no enterprise URI is set", async () => {
|
||||
it("returns true when no enterprise URI is set", async () => {
|
||||
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when GHES enterprise URI is set and variant analysis feature flag is not set", async () => {
|
||||
it("returns false when GHES enterprise URI is set", async () => {
|
||||
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
|
||||
"https://github.example.com",
|
||||
ConfigurationTarget.Global,
|
||||
|
@ -18,35 +15,11 @@ describe("checkVariantAnalysisEnabled", () => {
|
|||
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when GHES enterprise URI is set and variant analysis feature flag is set", async () => {
|
||||
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
|
||||
"https://github.example.com",
|
||||
ConfigurationTarget.Global,
|
||||
);
|
||||
await VARIANT_ANALYSIS_ENABLE_GHEC_DR.updateValue(
|
||||
"true",
|
||||
ConfigurationTarget.Global,
|
||||
);
|
||||
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when GHEC-DR URI is set and variant analysis feature flag is not set", async () => {
|
||||
it("returns true when a GHEC-DR URI is set", async () => {
|
||||
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
|
||||
"https://example.ghe.com",
|
||||
ConfigurationTarget.Global,
|
||||
);
|
||||
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true when GHEC-DR URI is set and variant analysis feature flag is set", async () => {
|
||||
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
|
||||
"https://example.ghe.com",
|
||||
ConfigurationTarget.Global,
|
||||
);
|
||||
await VARIANT_ANALYSIS_ENABLE_GHEC_DR.updateValue(
|
||||
"true",
|
||||
ConfigurationTarget.Global,
|
||||
);
|
||||
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче