Skip to content

Commit

Permalink
fix: kvm support message for virsh only lp#2053096 (#5325)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Feb 29, 2024
1 parent 6a9567f commit a478045
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,41 @@ describe("DeployFormFields", () => {
expect(screen.getByRole("radio", { name: /libvirt/ })).toBeInTheDocument();
});

it("displays support message only when 'virsh' is selected for KVM host type", async () => {
if (state.general.osInfo.data) {
state.general.osInfo.data.default_release = "bionic";
}
const store = mockStore(state);
render(
<Provider store={store}>
<MemoryRouter
initialEntries={[{ pathname: "/machines/add", key: "testKey" }]}
>
<CompatRouter>
<DeployForm
clearSidePanelContent={vi.fn()}
machines={[]}
processingCount={0}
viewingDetails={false}
/>
</CompatRouter>
</MemoryRouter>
</Provider>
);

const SUPPORT_MESSAGE =
"Only Ubuntu 18.04 LTS and Ubuntu 20.04 LTS are officially supported.";

await userEvent.click(
screen.getByRole("checkbox", { name: /Register as MAAS KVM host/ })
);
await userEvent.click(screen.getByRole("radio", { name: /libvirt/ }));
expect(screen.getByText(SUPPORT_MESSAGE)).toBeInTheDocument();

await userEvent.click(screen.getByRole("radio", { name: /LXD/ }));
expect(screen.queryByText(SUPPORT_MESSAGE)).not.toBeInTheDocument();
});

it("displays a warning if user has no SSH keys", () => {
if (state.user.auth.user) {
state.user.auth.user.sshkeys_count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ export const DeployFormFields = (): JSX.Element => {
<Input
checked={deployVmHost}
disabled={!canBeKVMHost || noImages}
help="Only Ubuntu 18.04 LTS and Ubuntu 20.04 LTS are officially supported."
help={
values.vmHostType === PodType.VIRSH
? "Only Ubuntu 18.04 LTS and Ubuntu 20.04 LTS are officially supported."
: undefined
}
id="deployVmHost"
label={
<>
Expand Down

0 comments on commit a478045

Please sign in to comment.