Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Added source version validation in 6.2.Z #1027

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cypress/e2e/tests/upgrade/create_upgrade_data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
getRandomApplicationData,
login,
preservecookies,
validateMtaVersionInCli,
validateMtaVersionInUi,
} from "../../../utils/utils";
import { TagCategory } from "../../models/migration/controls/tagcategory";
import * as data from "../../../utils/data_utils";
Expand All @@ -41,10 +43,13 @@ describe(["@pre-upgrade"], "Creating pre-requisites before an upgrade", () => {
let sourceControlUsernameCredentials: CredentialsSourceControlUsername;
const assessment = new Assessment(getRandomApplicationData());
let stakeHolder: Stakeholders;
const expectedMtaVersion = Cypress.env("sourceMtaVersion");

before("Login", function () {
// Perform login
login();
validateMtaVersionInCli(expectedMtaVersion);
validateMtaVersionInUi(expectedMtaVersion);
});

beforeEach("Persist session", function () {
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/views/common.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ export const nameHelperBusiness = "#business-service-name-helper";
export const nameHelperStakeholderGroup = "#-helper";
export const kebabMenuItem = "a.pf-c-dropdown__menu-item";
export const commonTable = "table[aria-label='main-table']";
export const aboutButton = "#about-button";
29 changes: 29 additions & 0 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
} from "../e2e/types/constants";
import { actionButton, date, createEntitiesCheckbox } from "../e2e/views/applicationinventory.view";
import {
aboutButton,
closeSuccessNotification,
confirmButton,
divHeader,
Expand Down Expand Up @@ -1757,3 +1758,31 @@ export function selectAssessmentApplications(apps: string): void {
export function closeModalWindow(): void {
click(closeModal, false, true);
}

export function getCommandOutput(command: string): Cypress.Chainable<Cypress.Exec> {
return cy.exec(command, { timeout: 30 * SEC }).then((result) => {
return result;
});
}

export function validateMtaVersionInCli(expectedMtaVersion: string): void {
const namespace = getNamespace();
const podName = `$(oc get pods -n${namespace}| grep ui|cut -d " " -f 1)`;
const command = `oc describe pod ${podName} -n${namespace}| grep -i version|awk '{print $2}'`;
getCommandOutput(command).then((output) => {
if (expectedMtaVersion !== output.stdout) {
throw new Error(
`Expected version in UI pod: ${expectedMtaVersion}, Actual version in UI pod: ${output.stdout}`
);
}
});
}

export function validateMtaVersionInUi(expectedVersion: string): void {
click(aboutButton);
cy.contains("dt", "Version")
.closest("dl")
.within(() => {
cy.get("dd").should("contain.text", expectedVersion);
});
}
Loading