Skip to content

feat: add all safe experiments to the deployment page #10276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added tests
  • Loading branch information
Kira-Pilot committed Oct 15, 2023
commit 00ea98e05403e7077156e8ba70af6d59eec0ee0f
46 changes: 43 additions & 3 deletions site/src/components/DeploySettingsLayout/optionValue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const defaultOption: ClibaseOption = {
describe("optionValue", () => {
it.each<{
option: ClibaseOption;
additionalValues?: string[];
expected: unknown;
}>([
{
Expand Down Expand Up @@ -67,7 +68,46 @@ describe("optionValue", () => {
},
expected: [`"123"->"foo"`, `"456"->"bar"`, `"789"->"baz"`],
},
])(`[$option.name]optionValue($option.value)`, ({ option, expected }) => {
expect(optionValue(option)).toEqual(expected);
});
{
option: {
...defaultOption,
name: "Experiments",
value: ["single_tailnet"],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: true, deployment_health_page: false },
},
{
option: {
...defaultOption,
name: "Experiments",
value: [],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: false, deployment_health_page: false },
},
{
option: {
...defaultOption,
name: "Experiments",
value: ["moons"],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: false, deployment_health_page: false },
},
{
option: {
...defaultOption,
name: "Experiments",
value: ["*"],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: { single_tailnet: true, deployment_health_page: true },
},
])(
`[$option.name]optionValue($option.value)`,
({ option, expected, additionalValues }) => {
expect(optionValue(option, additionalValues)).toEqual(expected);
},
);
});
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/optionValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function optionValue(
const experimentMap: Record<string, boolean> | undefined =
additionalValues?.reduce(
(acc, v) => {
return { ...acc, [v]: false };
return { ...acc, [v]: option.value.includes("*") ? true : false };
},
{} as Record<string, boolean>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
description:
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
flag: "experiments",
value: ["*", "moons", "single_tailnet", "deployment_health_page"],
value: ["single_tailnet"],
flag_shorthand: "",
hidden: false,
},
],
deploymentDAUs: MockDeploymentDAUResponse,
allExperiments: ["single_tailnet", "deployment_health_page"],
},
};

Expand Down Expand Up @@ -69,3 +70,38 @@ export const DAUError: Story = {
}),
},
};

export const allExperimentsEnabled: Story = {
args: {
deploymentOptions: [
{
name: "Access URL",
description:
"The URL that users will use to access the Coder deployment.",
flag: "access-url",
flag_shorthand: "",
value: "https://dev.coder.com",
hidden: false,
},
{
name: "Wildcard Access URL",
description:
'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".',
flag: "wildcard-access-url",
flag_shorthand: "",
value: "*--apps.dev.coder.com",
hidden: false,
},
{
name: "Experiments",
description:
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
flag: "experiments",
value: ["*"],
flag_shorthand: "",
hidden: false,
},
],
allExperiments: ["single_tailnet", "deployment_health_page"],
},
};