-
Notifications
You must be signed in to change notification settings - Fork 25
EVG-19946: Support Docker on provider settings page #2017
Changes from 1 commit
46ae0f3
32cd128
d7d501d
07b316c
9383586
405ce37
0a7ea2f
2f14006
9c5beb2
8e32f60
f2ab0cc
e3ee2db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,88 @@ | ||
import { save } from "./utils"; | ||
|
||
describe("provider section", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/localhost/settings/provider"); | ||
}); | ||
describe("static", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/localhost/settings/provider"); | ||
}); | ||
|
||
it("successfully updates static provider fields", () => { | ||
cy.dataCy("provider-select").contains("Static IP/VM"); | ||
|
||
// Correct fields are displayed | ||
cy.dataCy("provider-settings").within(() => { | ||
cy.get("button").should("have.length", 1); | ||
cy.get("textarea").should("have.length", 1); | ||
cy.get("input[type=checkbox]").should("have.length", 1); | ||
cy.get("input[type=text]").should("have.length", 0); | ||
}); | ||
|
||
cy.getInputByLabel("User Data").type("my user data"); | ||
cy.getInputByLabel("Merge with existing user data").check({ | ||
force: true, | ||
}); | ||
cy.contains("button", "Add security group").click(); | ||
cy.getInputByLabel("Security Group ID").type("group-1234"); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
|
||
it("successfully updates static provider fields", () => { | ||
cy.dataCy("provider-select").contains("Static IP/VM"); | ||
cy.getInputByLabel("User Data").clear(); | ||
cy.getInputByLabel("Merge with existing user data").uncheck({ | ||
force: true, | ||
}); | ||
cy.dataCy("delete-item-button").click(); | ||
|
||
// Correct fields are displayed | ||
cy.dataCy("provider-settings").within(() => { | ||
cy.get("button").should("have.length", 1); | ||
cy.get("textarea").should("have.length", 1); | ||
cy.get("input[type=checkbox]").should("have.length", 1); | ||
cy.get("input[type=text]").should("have.length", 0); | ||
save(); | ||
cy.validateToast("success"); | ||
}); | ||
}); | ||
|
||
cy.getInputByLabel("User Data").type("my user data"); | ||
cy.getInputByLabel("Merge with existing user data").check({ | ||
force: true, | ||
describe.only("docker", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/ubuntu1604-container-test/settings/provider"); | ||
}); | ||
cy.contains("button", "Add security group").click(); | ||
cy.getInputByLabel("Security Group ID").type("group-1234"); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
it("successfully updates docker provider fields", () => { | ||
cy.dataCy("provider-select").contains("Docker"); | ||
|
||
cy.getInputByLabel("User Data").clear(); | ||
cy.getInputByLabel("Merge with existing user data").uncheck({ | ||
force: true, | ||
}); | ||
cy.dataCy("delete-item-button").click(); | ||
// Correct fields are displayed | ||
cy.dataCy("provider-settings").within(() => { | ||
cy.getInputByLabel("Docker Image URL").should("exist"); | ||
cy.getInputByLabel("Image Build Method").should("exist"); | ||
cy.getInputByLabel("Username for Registries").should("exist"); | ||
cy.getInputByLabel("Password for Registries").should("exist"); | ||
cy.getInputByLabel("Container Pool ID").should("exist"); | ||
cy.getInputByLabel("Pool Mapping Information").should("exist"); | ||
cy.getInputByLabel("User Data").should("exist"); | ||
cy.getInputByLabel("Merge with existing user data").should("exist"); | ||
cy.contains("button", "Add security group").should("exist"); | ||
}); | ||
|
||
// Change field values. | ||
cy.selectLGOption("Image Build Method", "Pull"); | ||
cy.selectLGOption("Container Pool ID", /^test-pool$/); | ||
cy.getInputByLabel("Username for Registries").type("username"); | ||
cy.getInputByLabel("Password for Registries").type("password"); | ||
cy.getInputByLabel("User Data").type("my user data"); | ||
cy.getInputByLabel("Merge with existing user data").check({ | ||
force: true, | ||
}); | ||
save(); | ||
cy.validateToast("success"); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
// Revert fields to original values. | ||
cy.selectLGOption("Image Build Method", "Import"); | ||
cy.selectLGOption("Container Pool ID", "ubuntu-test-pool"); | ||
cy.getInputByLabel("Username for Registries").clear(); | ||
cy.getInputByLabel("Password for Registries").clear(); | ||
cy.getInputByLabel("User Data").clear(); | ||
cy.getInputByLabel("Merge with existing user data").uncheck({ | ||
force: true, | ||
}); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -47,7 +47,6 @@ import GET_PROJECTS from "./get-projects.graphql"; | |||||
import GET_MY_PUBLIC_KEYS from "./get-public-keys.graphql"; | ||||||
import GET_REPO_EVENT_LOGS from "./get-repo-event-logs.graphql"; | ||||||
import GET_REPO_SETTINGS from "./get-repo-settings.graphql"; | ||||||
import GET_SPRUCE_CONFIG from "./get-spruce-config.graphql"; | ||||||
import GET_SYSTEM_LOGS from "./get-system-logs.graphql"; | ||||||
import GET_TASK_ALL_EXECUTIONS from "./get-task-all-executions.graphql"; | ||||||
import GET_TASK_EVENT_LOGS from "./get-task-event-logs.graphql"; | ||||||
|
@@ -71,6 +70,7 @@ import PROJECT_HEALTH_VIEW from "./project-health-view.graphql"; | |||||
import GET_PROJECT_PATCHES from "./project-patches.graphql"; | ||||||
import GET_SPAWN_EXPIRATION_INFO from "./spawn-expiration.graphql"; | ||||||
import GET_SPAWN_TASK from "./spawn-task.graphql"; | ||||||
import GET_SPRUCE_CONFIG from "./spruce-config.graphql"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've been removing
Suggested change
|
||||||
import GET_SUBNET_AVAILABILITY_ZONES from "./subnet-availability-zones.graphql"; | ||||||
import TASK_QUEUE_DISTROS from "./task-queue-distros.graphql"; | ||||||
import USER_DISTRO_SETTINGS_PERMISSIONS from "./user-distro-settings-permissions.graphql"; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,12 +1,31 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { useMemo } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { DistroSettingsTabRoutes } from "constants/routes"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { useSpruceConfig } from "hooks"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { useDistroSettingsContext } from "pages/distroSettings/Context"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { omitTypename } from "utils/string"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { BaseTab } from "../BaseTab"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { getFormSchema } from "./getFormSchema"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { TabProps } from "./types"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
export const ProviderTab: React.FC<TabProps> = ({ distroData }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
const initialFormState = distroData; | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] No need to rename this var (even though I think we have been doing it unnecessarily in every tab 😂) |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
const formSchema = useMemo(() => getFormSchema(), []); | ||||||||||||||||||||||||||||||||||||||||||||||||||
const { getTab } = useDistroSettingsContext(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
const { formData } = getTab(DistroSettingsTabRoutes.Provider); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
const { containerPools } = useSpruceConfig(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
const { pools = [] } = containerPools || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
const selectedPoolId = formData?.providerSettings?.containerPoolId; | ||||||||||||||||||||||||||||||||||||||||||||||||||
const selectedPool = pools.find((p) => p.id === selectedPoolId) ?? null; | ||||||||||||||||||||||||||||||||||||||||||||||||||
const poolMappingInfo = selectedPool | ||||||||||||||||||||||||||||||||||||||||||||||||||
? JSON.stringify(omitTypename(selectedPool), null, 4) | ||||||||||||||||||||||||||||||||||||||||||||||||||
: ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
const formSchema = useMemo( | ||||||||||||||||||||||||||||||||||||||||||||||||||
() => getFormSchema({ pools, poolMappingInfo }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
[pools, poolMappingInfo] | ||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
<BaseTab formSchema={formSchema} initialFormState={initialFormState} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.