From 9f3e7be03a36ef394fab64801fa7e5b877107a33 Mon Sep 17 00:00:00 2001 From: Fede Alonso Date: Thu, 1 Aug 2024 00:15:15 +0200 Subject: [PATCH] lint fixes --- .../tests/e2e/pipelines/pipelines.cy.ts | 12 ++--- .../cypress/utils/oc_commands/baseCommands.ts | 2 +- .../utils/oc_commands/dataConnection.ts | 26 +++++------ .../cypress/cypress/utils/oc_commands/dspa.ts | 46 +++++++++---------- .../cypress/utils/oc_commands/project.ts | 9 ++-- 5 files changed, 47 insertions(+), 48 deletions(-) diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts index ffa269f96d..efee67ea21 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts @@ -1,4 +1,7 @@ -import { createOpenShiftProject, deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project'; +import { + createOpenShiftProject, + deleteOpenShiftProject, +} from '~/__tests__/cypress/cypress/utils/oc_commands/project'; import { createDataConnection } from '~/__tests__/cypress/cypress/utils/oc_commands/dataConnection'; import { createDSPASecret, createDSPA } from '~/__tests__/cypress/cypress/utils/oc_commands/dspa'; import { replacePlaceholdersInYaml } from '~/__tests__/cypress/cypress/utils/yaml_files'; @@ -47,12 +50,10 @@ describe('An admin user can import and run a pipeline', { testIsolation: false } const dspaReplacements = { DSPA_SECRET_NAME: dspaSecretName, NAMESPACE: projectName, - AWS_S3_BUCKET: AWS_BUCKETS.BUCKET_2.NAME + AWS_S3_BUCKET: AWS_BUCKETS.BUCKET_2.NAME, }; createDSPA(dspaReplacements); - - // cy.fixture('resources/yaml/data_connection.yml').then((yamlContent) => { // const modifiedYamlContent = replacePlaceholdersInYaml( // yamlContent, @@ -97,7 +98,6 @@ describe('An admin user can import and run a pipeline', { testIsolation: false } }); it('An admin User can Import and Run a Pipeline', () => { - // Login as an admin cy.visitWithLogin('/', ADMIN_USER); @@ -108,7 +108,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false } // Open the project projectListPage.findProjectLink(projectName).click(); - + // Increasing the timeout to ~3mins so the DSPA can be loaded projectDetails.findImportPipelineButton(180000).click(); diff --git a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/baseCommands.ts b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/baseCommands.ts index b24caaf87f..03ad5b573c 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/baseCommands.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/baseCommands.ts @@ -16,4 +16,4 @@ export const applyOpenShiftYaml = (yamlContent: string) => { } return result; }); -}; \ No newline at end of file +}; diff --git a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dataConnection.ts b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dataConnection.ts index dbab425881..faecf3564e 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dataConnection.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dataConnection.ts @@ -1,10 +1,10 @@ -import { replacePlaceholdersInYaml } from "../yaml_files"; -import { applyOpenShiftYaml } from "./baseCommands"; +import { replacePlaceholdersInYaml } from '~/__tests__/cypress/cypress/utils/yaml_files'; +import { applyOpenShiftYaml } from './baseCommands'; /** * Try to create a data connection based on the dataConnectionReplacements config * @param dataConnectionReplacements Dictionary with the config values - * Dict Structure: + * Dict Structure: * dataConnectionReplacements = { * NAMESPACE: , * AWS_ACCESS_KEY_ID: , @@ -13,16 +13,16 @@ import { applyOpenShiftYaml } from "./baseCommands"; * AWS_S3_ENDPOINT: , * AWS_SECRET_ACCESS_KEY: , * } - * @param yamlFilePath + * @param yamlFilePath */ export const createDataConnection = ( - dataConnectionReplacements: { [key: string]: string }, - yamlFilePath: string = 'resources/yaml/data_connection.yml' - ) => { - cy.fixture(yamlFilePath).then((yamlContent) => { - const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dataConnectionReplacements); - applyOpenShiftYaml(modifiedYamlContent).then((result) => { - return result; - }); + dataConnectionReplacements: { [key: string]: string }, + yamlFilePath = 'resources/yaml/data_connection.yml', +) => { + cy.fixture(yamlFilePath).then((yamlContent) => { + const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dataConnectionReplacements); + applyOpenShiftYaml(modifiedYamlContent).then((result) => { + return result; }); - }; \ No newline at end of file + }); +}; diff --git a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dspa.ts b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dspa.ts index 8eedd344c2..1a2bf77e6a 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dspa.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/dspa.ts @@ -1,49 +1,49 @@ -import { replacePlaceholdersInYaml } from "../yaml_files"; -import { applyOpenShiftYaml } from "./baseCommands"; +import { replacePlaceholdersInYaml } from '~/__tests__/cypress/cypress/utils/yaml_files'; +import { applyOpenShiftYaml } from './baseCommands'; /** * Try to create a DSPA Secret based on the dspaSecretReplacements config * @param dspaSecretReplacements Dictionary with the config values - * Dict Structure: + * Dict Structure: * dspaSecretReplacements = { * DSPA_SECRET_NAME: , * NAMESPACE: , * AWS_ACCESS_KEY_ID: , * AWS_SECRET_ACCESS_KEY: , * } - * @param yamlFilePath + * @param yamlFilePath */ export const createDSPASecret = ( - dspaSecretReplacements: { [key: string]: string }, - yamlFilePath: string = 'resources/yaml/dspa_secret.yml' - ) => { - cy.fixture(yamlFilePath).then((yamlContent) => { - const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dspaSecretReplacements); - applyOpenShiftYaml(modifiedYamlContent).then((result) => { - return result; - }); + dspaSecretReplacements: { [key: string]: string }, + yamlFilePath = 'resources/yaml/dspa_secret.yml', +) => { + cy.fixture(yamlFilePath).then((yamlContent) => { + const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dspaSecretReplacements); + applyOpenShiftYaml(modifiedYamlContent).then((result) => { + return result; }); + }); }; /** * Try to create a DSPA based on the dspaReplacements config * @param dspaReplacements Dictionary with the config values - * Dict Structure: + * Dict Structure: * dspaSecretReplacements = { * DSPA_SECRET_NAME: , * NAMESPACE: , * AWS_S3_BUCKET: * } - * @param yamlFilePath + * @param yamlFilePath */ export const createDSPA = ( - dspaReplacements: { [key: string]: string }, - yamlFilePath: string = 'resources/yaml/dspa.yml' - ) => { - cy.fixture(yamlFilePath).then((yamlContent) => { - const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dspaReplacements); - applyOpenShiftYaml(modifiedYamlContent).then((result) => { - return result; - }); + dspaReplacements: { [key: string]: string }, + yamlFilePath = 'resources/yaml/dspa.yml', +) => { + cy.fixture(yamlFilePath).then((yamlContent) => { + const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dspaReplacements); + applyOpenShiftYaml(modifiedYamlContent).then((result) => { + return result; }); -}; \ No newline at end of file + }); +}; diff --git a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/project.ts b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/project.ts index 9e1364bfb3..c72d697548 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/oc_commands/project.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/oc_commands/project.ts @@ -10,15 +10,15 @@ export const createOpenShiftProject = (projectName: string, displayName?: string const ocCommand = `oc new-project ${projectName} --display-name='${finalDisplayName}'`; return cy.exec(ocCommand, { failOnNonZeroExit: false }).then((result) => { if (result.code !== 0) { - cy.log(`ERROR provisioning ${projectName} Project + cy.log(`ERROR provisioning ${projectName} Project stdout: ${result.stdout} stderr: ${result.stderr}`); - throw new Error(`Command failed with code ${result.code}`); - } + throw new Error(`Command failed with code ${result.code}`); + } return result; }); }; - + /** * Delete an Openshift Project given its name * @@ -29,4 +29,3 @@ export const deleteOpenShiftProject = (projectName: string) => { const ocCommand = `oc delete project ${projectName}`; return cy.exec(ocCommand, { failOnNonZeroExit: false }).then(() => {}); }; - \ No newline at end of file