This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
19 changed files
with
645 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { save } from "./utils"; | ||
|
||
describe("host section", () => { | ||
describe("using legacy ssh", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/localhost/settings/host"); | ||
}); | ||
|
||
it("shows the correct fields when distro has static provider", () => { | ||
cy.dataCy("authorized-keys-input").should("exist"); | ||
cy.dataCy("minimum-hosts-input").should("not.exist"); | ||
cy.dataCy("maximum-hosts-input").should("not.exist"); | ||
cy.dataCy("idle-time-input").should("not.exist"); | ||
cy.dataCy("future-fraction-input").should("not.exist"); | ||
}); | ||
|
||
it("errors when selecting an incompatible host communication method", () => { | ||
cy.selectLGOption("Host Communication Method", "RPC"); | ||
save(); | ||
cy.validateToast( | ||
"error", | ||
"validating changes for distro 'localhost': 'ERROR: bootstrapping hosts using legacy SSH is incompatible with non-legacy host communication'" | ||
); | ||
cy.selectLGOption("Host Communication Method", "Legacy SSH"); | ||
}); | ||
|
||
it("updates host fields", () => { | ||
cy.selectLGOption("Agent Architecture", "Linux ARM 64-bit"); | ||
cy.getInputByLabel("Working Directory").clear(); | ||
cy.getInputByLabel("Working Directory").type("/usr/local/bin"); | ||
cy.getInputByLabel("SSH User").clear(); | ||
cy.getInputByLabel("SSH User").type("sudo"); | ||
cy.contains("button", "Add SSH option").click(); | ||
cy.getInputByLabel("SSH Option").type("BatchMode=yes"); | ||
cy.selectLGOption("Host Allocator Rounding Rule", "Round down"); | ||
cy.selectLGOption("Host Allocator Feedback Rule", "No feedback"); | ||
cy.selectLGOption( | ||
"Host Overallocation Rule", | ||
"Terminate hosts when overallocated" | ||
); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
|
||
// Reset fields | ||
cy.selectLGOption("Agent Architecture", "Linux 64-bit"); | ||
cy.getInputByLabel("Working Directory").clear(); | ||
cy.getInputByLabel("Working Directory").type("/home/ubuntu/smoke"); | ||
cy.getInputByLabel("SSH User").clear(); | ||
cy.getInputByLabel("SSH User").type("ubuntu"); | ||
cy.dataCy("delete-item-button").click(); | ||
cy.selectLGOption("Host Allocator Rounding Rule", "Default"); | ||
cy.selectLGOption("Host Allocator Feedback Rule", "Default"); | ||
cy.selectLGOption("Host Overallocation Rule", "Default"); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import styled from "@emotion/styled"; | ||
import { STANDARD_FIELD_WIDTH } from "./utils"; | ||
|
||
const ElementWrapper = styled.div` | ||
type ElementWrapperProps = { | ||
limitMaxWidth?: boolean; | ||
}; | ||
|
||
const ElementWrapper = styled.div<ElementWrapperProps>` | ||
margin-bottom: 20px; | ||
${({ limitMaxWidth }) => | ||
limitMaxWidth && `max-width: ${STANDARD_FIELD_WIDTH}px;`} | ||
`; | ||
|
||
export default ElementWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ query SpruceConfig { | |
jira { | ||
host | ||
} | ||
keys { | ||
location | ||
name | ||
} | ||
providers { | ||
aws { | ||
maxVolumeSizePerUser | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useMemo } from "react"; | ||
import { useSpruceConfig } from "hooks"; | ||
import { BaseTab } from "../BaseTab"; | ||
import { getFormSchema } from "./getFormSchema"; | ||
import { TabProps } from "./types"; | ||
|
||
export const HostTab: React.FC<TabProps> = ({ distroData, provider }) => { | ||
const spruceConfig = useSpruceConfig(); | ||
const sshKeys = spruceConfig?.keys; | ||
|
||
const formSchema = useMemo( | ||
() => getFormSchema({ provider, sshKeys }), | ||
[provider, sshKeys] | ||
); | ||
|
||
return <BaseTab formSchema={formSchema} initialFormState={distroData} />; | ||
}; |
Oops, something went wrong.