From 73e7a51ab03dbe7151230b3ad652b7dfc970f7e2 Mon Sep 17 00:00:00 2001 From: regexowl Date: Mon, 20 Jan 2025 15:47:23 +0100 Subject: [PATCH] Wizard: Add firewall to on-prem mapper This adds firewall to on-prem mapper. --- .../helpers/onPremToHostedBlueprintMapper.tsx | 1 + .../Blueprints/ImportBlueprintModal.test.tsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Components/Blueprints/helpers/onPremToHostedBlueprintMapper.tsx b/src/Components/Blueprints/helpers/onPremToHostedBlueprintMapper.tsx index aa3ab462..24e72bb0 100644 --- a/src/Components/Blueprints/helpers/onPremToHostedBlueprintMapper.tsx +++ b/src/Components/Blueprints/helpers/onPremToHostedBlueprintMapper.tsx @@ -169,6 +169,7 @@ export const mapOnPremToHosted = ( append: blueprint.customizations.kernel.append, } : undefined, + firewall: blueprint.customizations?.firewall || undefined, }, metadata: { parent_id: null, diff --git a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx index 36cf5c6d..cda39e76 100644 --- a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx +++ b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx @@ -184,6 +184,12 @@ keyboard = "us" [customizations.kernel] name = "kernel-debug" append = "nosmt=force" + +[customizations.firewall] +ports = ["22:tcp", "80:tcp", "imap:tcp"] +[customizations.firewall.services] +enabled = ["ftp", "ntp"] +disabled = ["telnet"] `; const uploadFile = async (filename: string, content: string): Promise => { @@ -390,5 +396,17 @@ describe('Import modal', () => { ); expect(kernelNameInput).toHaveValue('kernel-debug'); await screen.findByText('nosmt=force'); + + // Firewall + await clickNext(); + // check ports + await screen.findByText('22:tcp'); + await screen.findByText('80:tcp'); + await screen.findByText('imap:tcp'); + // check disabled services + await screen.findByText('telnet'); + // check enabled services + await screen.findByText('ftp'); + await screen.findByText('ntp'); }, 20000); });