Skip to content

Commit

Permalink
Added debug message in case test fails (#1191)
Browse files Browse the repository at this point in the history
* Adding debug message

Signed-off-by: Maayan Hadasi <[email protected]>

* Correcting description message

Signed-off-by: Maayan Hadasi <[email protected]>

---------

Signed-off-by: Maayan Hadasi <[email protected]>
  • Loading branch information
mguetta1 authored Aug 13, 2024
1 parent dd624c6 commit b9ebb39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/tests/upgrade/after_upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import {
validateTackleCr,
getCommandOutput,
getNamespace,
validateTackleOperatorLog,
validateMtaVersionInUI,
validateMtaVersionInCLI,
isRwxEnabled,
validateMtaOperatorLog,
} from "../../../utils/utils";
import { UpgradeData } from "../../types/types";
import { Credentials } from "../../models/administration/credentials/credentials";
Expand Down Expand Up @@ -76,7 +76,7 @@ describe(["@post-upgrade"], "Performing post-upgrade validations", () => {

it("Validate Tackle CR", () => validateTackleCr());

it("Validate Tackle Operator Log", () => validateTackleOperatorLog());
it("Validate MTA Operator Log", () => validateMtaOperatorLog());

it("Controls - testing existence of instances created before upgrade", function () {
const {
Expand Down
7 changes: 6 additions & 1 deletion cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1852,11 +1852,16 @@ export function validateTackleCr(): void {
});
}

export function validateTackleOperatorLog(): void {
export function validateMtaOperatorLog(): void {
cy.wait(30 * SEC);
let command = `oc logs $(oc get pods | grep mta-operator | cut -d " " -f 1) | grep failed | tail -n 1| awk -F 'failed=' '{print $2}'|cut -d " " -f 1`;
getCommandOutput(command).then((result) => {
const failedCount = parseInt(result.stdout.trim());
if (Number.isNaN(failedCount)) {
throw `Debugging output\n
result.stdout: ${result.stdout}EOV\n
failedCount: ${failedCount}EOV`;
}
expect(failedCount).equal(0);
});
}
Expand Down

0 comments on commit b9ebb39

Please sign in to comment.