Skip to content

Commit

Permalink
Saving changes, but not ready yet
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Braginsky <[email protected]>
  • Loading branch information
ibragins committed Feb 11, 2024
1 parent 0a9693d commit 4a38ce4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
12 changes: 6 additions & 6 deletions cypress/e2e/tests/upgrade/after_upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getRandomApplicationData,
isEnabled,
login,
getPodsList,
getMtaPodsList,
} from "../../../utils/utils";
import { UpgradeData } from "../../types/types";
import { Credentials } from "../../models/administration/credentials/credentials";
Expand Down Expand Up @@ -57,14 +57,14 @@ describe(["@post-upgrade"], "Performing post-upgrade validations", () => {

it("Getting pods and their statuses", function () {
const projectName = "openshift-mta";
getPodsList(projectName).then((pods: Pod[]) => {
getMtaPodsList(projectName).then((pods: string[]) => {
pods.forEach((pod) => {
cy.log(pod.name);
cy.log(pod);
});
});
});

it("Controls - testing existence of instances created before upgrade", function () {
it.skip("Controls - testing existence of instances created before upgrade", function () {
const {
sourceControlUsernameCredentialsName,
mavenUsernameCredentialName,
Expand Down Expand Up @@ -99,7 +99,7 @@ describe(["@post-upgrade"], "Performing post-upgrade validations", () => {
exists(tagName);
});

it("Applications - testing existence of instances created before upgrade", function () {
it.skip("Applications - testing existence of instances created before upgrade", function () {
const { sourceApplicationName, binaryApplicationName, uploadBinaryApplicationName } =
this.upgradeData;

Expand Down Expand Up @@ -143,7 +143,7 @@ describe(["@post-upgrade"], "Performing post-upgrade validations", () => {
sourceApplication.selectApplication();
});

it("Enabling RWX, validating it works, disabling it", function () {
it.skip("Enabling RWX, validating it works, disabling it", function () {
MavenConfiguration.open();
let rwxEnabled = false;
isEnabled(clearRepository, rwxEnabled);
Expand Down
43 changes: 26 additions & 17 deletions cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1798,23 +1798,32 @@ export function validateSortBy(sortBy: string, tdSelector?: string) {
verifySortDesc(afterDescSortList, unsortedList);
}

export const getPodsList = (projectName: string): Cypress.Chainable<Pod[]> => {
const command = `oc get pods -o json -n ${projectName}`;

// export const getMtaPodsList = (projectName: string): Cypress.Chainable<Pod[]> => {
// const command = `oc get pods -o json -n ${projectName}`;
//
// return cy.task("exec", command).then((result: any) => {
// console.log(result.stdout);
// cy.log(result.stdout);
// const pods: Pod[] = Array.prototype.slice
// .call(JSON.parse(result.stdout))
// .map((podData: any) => {
// const podStatus = podData.status.conditions.find(
// (condition: any) => condition.type === "Ready"
// );
// const status = podStatus ? "Running" : "Pending"; // TODO: Check if more statuses should be added
//
// return {
// name: podData.metadata.name,
// status: status,
// };
// });
// return pods;
// });
// };

export const getMtaPodsList = (projectName: string): Cypress.Chainable<string[]> => {
const command = `oc get pods -n ${projectName} --no-headers -o custom-columns=:metadata.name | grep -v task`;
return cy.task("exec", command).then((result: any) => {
console.log(result.stdout);
cy.log(result.stdout);
const pods: Pod[] = result.stdout.map((podData: any) => {
const podStatus = podData.status.conditions.find(
(condition: any) => condition.type === "Ready"
);
const status = podStatus ? "Running" : "Pending"; // TODO: Check if more statuses should be added

return {
name: podData.metadata.name,
status: status,
};
});
return pods;
return result;
});
};

0 comments on commit 4a38ce4

Please sign in to comment.