From fa1ee12f339ebc4398ff3dd2c09f9f0ee64f15e9 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Wed, 5 Jul 2023 17:49:01 -0400 Subject: [PATCH 1/3] Fix tests affected by distros resolver --- .../integration/hosts/update_status_modal.ts | 3 ++- cypress/integration/spawn/host.ts | 17 ++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cypress/integration/hosts/update_status_modal.ts b/cypress/integration/hosts/update_status_modal.ts index 48a27f6a34..a6fcfdf2eb 100644 --- a/cypress/integration/hosts/update_status_modal.ts +++ b/cypress/integration/hosts/update_status_modal.ts @@ -25,7 +25,8 @@ describe("Update Status Modal", () => { cy.contains("button", "Update").click({ force: true }); }); cy.dataCy("update-host-status-modal").should("not.exist"); - cy.validateToast("success"); + // Because the static hosts that exists in the dev environment cannot be decommissioned, we should expect an error. + cy.validateToast("error"); // MODAL FORM VALUES SHOULD BE CLEARED AFTER MUTATION cy.dataCy("update-status-button").click(); diff --git a/cypress/integration/spawn/host.ts b/cypress/integration/spawn/host.ts index cecc56c2d1..904ce4718c 100644 --- a/cypress/integration/spawn/host.ts +++ b/cypress/integration/spawn/host.ts @@ -1,7 +1,6 @@ const hostTableRow = ".ant-table-row"; const hostColumnHeader = ".ant-table-thead > tr > :nth-child(2)"; -const unsortedSpawnHostOrder = ["i-092593689871a50dc", "i-04ade558e1e26b0ad"]; const ascendingSortSpawnHostOrderByHostId = [ "i-04ade558e1e26b0ad", "i-092593689871a50dc", @@ -46,7 +45,9 @@ describe("Navigating to Spawn Host page", () => { cy.dataCy("spawn-host-card").should("have.length", 1); }); it("Clicking on the Event Log link should redirect to /host/:hostId", () => { - cy.contains("Event Log").click(); + cy.get('[data-row-key="i-092593689871a50dc"]').within(() => { + cy.contains("Event Log").click(); + }); cy.location("pathname").should("eq", "/host/i-092593689871a50dc"); }); @@ -55,9 +56,7 @@ describe("Navigating to Spawn Host page", () => { cy.visit("/spawn/host"); }); it("Visiting the spawn host page should display all of your spawned hosts not sorted by default", () => { - cy.get(hostTableRow).each(($el, index) => - cy.wrap($el).contains(unsortedSpawnHostOrder[index]) - ); + cy.get(hostTableRow).should("have.length", 2); }); it("Clicking on the host column header should sort spawn hosts by ascending order by id", () => { cy.get(hostColumnHeader).click(); @@ -76,9 +75,7 @@ describe("Navigating to Spawn Host page", () => { cy.get(hostColumnHeader).click(); cy.get(hostColumnHeader).click(); cy.get(hostColumnHeader).click(); - cy.get(hostTableRow).each(($el, index) => - cy.wrap($el).contains(unsortedSpawnHostOrder[index]) - ); + cy.get(hostTableRow).should("have.length", 2); }); it("Clicking on the expiration column header should sort the hosts by ascending order", () => { cy.contains("Expires In").click(); @@ -97,9 +94,7 @@ describe("Navigating to Spawn Host page", () => { cy.contains("Expires In").click(); cy.contains("Expires In").click(); cy.contains("Expires In").click(); - cy.get(hostTableRow).each(($el, index) => - cy.wrap($el).contains(unsortedSpawnHostOrder[index]) - ); + cy.get(hostTableRow).should("have.length", 2); }); describe("Spawn host modal", () => { From 0cbfd0c7f45b80b14cbd68e66107ea73dd968fed Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 7 Jul 2023 11:00:00 -0400 Subject: [PATCH 2/3] Codegen --- src/gql/generated/types.ts | 122 +++++++++++++++++++++++++++++++++++-- 1 file changed, 117 insertions(+), 5 deletions(-) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 741332f0f8..e24690afa1 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -67,6 +67,21 @@ export enum BannerTheme { Warning = "WARNING", } +export type BootstrapSettings = { + __typename?: "BootstrapSettings"; + clientDir?: Maybe; + communication?: Maybe; + env: Array; + jasperBinaryDir?: Maybe; + jasperCredentialsPath?: Maybe; + method?: Maybe; + preconditionScripts: Array; + resourceLimits?: Maybe; + rootDir?: Maybe; + serviceUser?: Maybe; + shellPath?: Maybe; +}; + export type Build = { __typename?: "Build"; actualMakespan: Scalars["Duration"]; @@ -235,21 +250,47 @@ export type Dependency = { taskId: Scalars["String"]; }; +export type DispatcherSettings = { + __typename?: "DispatcherSettings"; + version?: Maybe; +}; + export type DisplayTask = { ExecTasks: Array; Name: Scalars["String"]; }; -/** - * Distro[] is the return value for the distros query. - * It models an environment configuration for a host. - */ +/** Distro models an environment configuration for a host. */ export type Distro = { __typename?: "Distro"; + aliases: Array; + arch?: Maybe; + authorizedKeysFile?: Maybe; + bootstrapSettings: BootstrapSettings; + cloneMethod?: Maybe; + containerPool?: Maybe; + disableShallowClone: Scalars["Boolean"]; + disabled: Scalars["Boolean"]; + dispatcherSettings: DispatcherSettings; + expansions: Array; + finderSettings: FinderSettings; + homeVolumeSettings: HomeVolumeSettings; + hostAllocatorSettings: HostAllocatorSettings; + iceCreamSettings: IceCreamSettings; + isCluster: Scalars["Boolean"]; isVirtualWorkStation: Scalars["Boolean"]; name?: Maybe; + note?: Maybe; + plannerSettings: PlannerSettings; + provider?: Maybe; + providerSettingsList: Array; + setup?: Maybe; + setupAsSudo: Scalars["Boolean"]; + sshKey?: Maybe; + sshOptions: Array; user?: Maybe; - userSpawnAllowed?: Maybe; + userSpawnAllowed: Scalars["Boolean"]; + validProjects: Array>; workDir?: Maybe; }; @@ -294,6 +335,18 @@ export type EditSpawnHostInput = { volume?: InputMaybe; }; +export type EnvVar = { + __typename?: "EnvVar"; + key?: Maybe; + value?: Maybe; +}; + +export type Expansion = { + __typename?: "Expansion"; + key?: Maybe; + value?: Maybe; +}; + export type ExternalLink = { __typename?: "ExternalLink"; displayName: Scalars["String"]; @@ -327,6 +380,11 @@ export type FileDiff = { fileName: Scalars["String"]; }; +export type FinderSettings = { + __typename?: "FinderSettings"; + version?: Maybe; +}; + export type GeneralSubscription = { __typename?: "GeneralSubscription"; id: Scalars["String"]; @@ -412,6 +470,11 @@ export type GroupedTaskStatusCount = { variant: Scalars["String"]; }; +export type HomeVolumeSettings = { + __typename?: "HomeVolumeSettings"; + formatCommand?: Maybe; +}; + /** Host models a host, which are used for things like running tasks or as virtual workstations. */ export type Host = { __typename?: "Host"; @@ -441,6 +504,17 @@ export type Host = { volumes: Array; }; +export type HostAllocatorSettings = { + __typename?: "HostAllocatorSettings"; + acceptableHostIdleTime?: Maybe; + feedbackRule?: Maybe; + hostsOverallocatedRule?: Maybe; + maximumHosts: Scalars["Int"]; + minimumHosts: Scalars["Int"]; + roundingRule?: Maybe; + version?: Maybe; +}; + export type HostEventLogData = { __typename?: "HostEventLogData"; agentBuild: Scalars["String"]; @@ -504,6 +578,12 @@ export type HostsResponse = { totalHostsCount: Scalars["Int"]; }; +export type IceCreamSettings = { + __typename?: "IceCreamSettings"; + configPath?: Maybe; + schedulerHost?: Maybe; +}; + export type InstanceTag = { __typename?: "InstanceTag"; canBeModified: Scalars["Boolean"]; @@ -1191,6 +1271,18 @@ export type Permissions = { userId: Scalars["String"]; }; +export type PlannerSettings = { + __typename?: "PlannerSettings"; + expectedRuntimeFactor?: Maybe; + generateTaskFactor?: Maybe; + groupVersions?: Maybe; + mainlineTimeInQueueFactor?: Maybe; + patchFactor?: Maybe; + patchTimeInQueueFactor?: Maybe; + targetTime?: Maybe; + version?: Maybe; +}; + export type Pod = { __typename?: "Pod"; events: PodEvents; @@ -1238,6 +1330,12 @@ export type PodEvents = { eventLogEntries: Array; }; +export type PreconditionScript = { + __typename?: "PreconditionScript"; + path?: Maybe; + script?: Maybe; +}; + /** Project models single repository on GitHub. */ export type Project = { __typename?: "Project"; @@ -1495,6 +1593,7 @@ export type Query = { buildVariantsForTaskName?: Maybe>>; clientConfig?: Maybe; commitQueue: CommitQueue; + distro?: Maybe; distroTaskQueue: Array; distros: Array>; githubProjectConflicts: GithubProjectConflicts; @@ -1548,6 +1647,10 @@ export type QueryCommitQueueArgs = { projectIdentifier: Scalars["String"]; }; +export type QueryDistroArgs = { + distroId: Scalars["String"]; +}; + export type QueryDistroTaskQueueArgs = { distroId: Scalars["String"]; }; @@ -1791,6 +1894,15 @@ export enum RequiredStatus { MustSucceed = "MUST_SUCCEED", } +export type ResourceLimits = { + __typename?: "ResourceLimits"; + lockedMemoryKb?: Maybe; + numFiles?: Maybe; + numProcesses?: Maybe; + numTasks?: Maybe; + virtualMemoryKb?: Maybe; +}; + export type SearchReturnInfo = { __typename?: "SearchReturnInfo"; featuresURL: Scalars["String"]; From d2a0b070fe01b3d081a514f8b27600797f66ef87 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 7 Jul 2023 11:08:20 -0400 Subject: [PATCH 3/3] Remove tests confirming modal is cleared since we no longer expect a successful mutation --- cypress/integration/hosts/update_status_modal.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cypress/integration/hosts/update_status_modal.ts b/cypress/integration/hosts/update_status_modal.ts index a6fcfdf2eb..334aea43d5 100644 --- a/cypress/integration/hosts/update_status_modal.ts +++ b/cypress/integration/hosts/update_status_modal.ts @@ -27,14 +27,5 @@ describe("Update Status Modal", () => { cy.dataCy("update-host-status-modal").should("not.exist"); // Because the static hosts that exists in the dev environment cannot be decommissioned, we should expect an error. cy.validateToast("error"); - - // MODAL FORM VALUES SHOULD BE CLEARED AFTER MUTATION - cy.dataCy("update-status-button").click(); - - cy.dataCy("host-status-select").within(() => { - cy.get(".ant-select-selection-item").should("not.exist"); - }); - - cy.dataCy("host-status-notes").invoke("val").should("eq", ""); }); });