From 14e2d66151045a20a29f20a21c1c13e6451117a9 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Mon, 8 Jul 2024 16:27:50 +0200 Subject: [PATCH 01/13] Added a better check for the presence of graalvm --- .../probes/SupportedStackJSModulesProbe.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java index 83380da..d72c95e 100644 --- a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java +++ b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java @@ -25,18 +25,21 @@ public ProbeStatus getStatus() { String vmVendor = System.getProperty("java.vm.vendor", "Unknown"); Version jvmVersion = new Version(System.getProperty("java.version", "Unknown")); + Version graalVMVersion = new Version(System.getProperty("org.graalvm.version", "Unknown")); // This probe is only relevant for Jahia 8.2.0.0+ in which npm-modules-engine is available. // Not testing Jahia version since it is not to be backported to older versions of SAM. ProbeStatus status = new ProbeStatus("No issues to report", ProbeStatus.Health.GREEN); if (!isNpmModulesEngineStarted) { status = ProbeStatusUtils.aggregateStatus(status, "The environment is not running JS modules (npm-modules-engine stopped or not present)", ProbeStatus.Health.GREEN); - } else { - if (!vmVendor.contains("GraalVM")) { - status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM not detected on the environment (detected vendor: %s), after switching to GraalVM make sure to enable the Javascript extension", vmVendor), ProbeStatus.Health.RED); + } else if (System.getProperty("org.graalvm.version", "Unknown") == "Unknown") { + status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM not detected on the environment (detected vendor: %s with JVM version: %s), after switching to GraalVM 22.3.3+ with JVM version 17+, make sure to enable the Javascript extension", vmVendor, jvmVersion), ProbeStatus.Health.RED); + } else { + if (jvmVersion.compareTo(new Version("22.3.3")) <= 0) { + status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM version 22.3.3 or newer required (detected GraalVM version: %s)", graalVMVersion), ProbeStatus.Health.RED); } if (jvmVersion.compareTo(new Version("17")) <= 0) { - status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM with JVM version 17 or newer required (detected: %s)", jvmVersion), ProbeStatus.Health.RED); + status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM with JVM version 17 or newer required (detected JVM version: %s)", jvmVersion), ProbeStatus.Health.RED); } if (vmVendor.contains("GraalVM") && !isJavaScriptModuleInstalled()) { status = ProbeStatusUtils.aggregateStatus(status, "GraalVM is detected but the JavaScript extension is not installed", ProbeStatus.Health.RED); From 2bb5c8201d0560f597244402a90a5c55d650d393 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Mon, 8 Jul 2024 16:58:04 +0200 Subject: [PATCH 02/13] Fix following feedback --- .../sam/healthcheck/probes/SupportedStackJSModulesProbe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java index d72c95e..9219cc0 100644 --- a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java +++ b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java @@ -32,10 +32,10 @@ public ProbeStatus getStatus() { ProbeStatus status = new ProbeStatus("No issues to report", ProbeStatus.Health.GREEN); if (!isNpmModulesEngineStarted) { status = ProbeStatusUtils.aggregateStatus(status, "The environment is not running JS modules (npm-modules-engine stopped or not present)", ProbeStatus.Health.GREEN); - } else if (System.getProperty("org.graalvm.version", "Unknown") == "Unknown") { + } else if (System.getProperty("org.graalvm.version") == null) { status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM not detected on the environment (detected vendor: %s with JVM version: %s), after switching to GraalVM 22.3.3+ with JVM version 17+, make sure to enable the Javascript extension", vmVendor, jvmVersion), ProbeStatus.Health.RED); } else { - if (jvmVersion.compareTo(new Version("22.3.3")) <= 0) { + if (graalVMVersion.compareTo(new Version("22.3.3")) <= 0) { status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM version 22.3.3 or newer required (detected GraalVM version: %s)", graalVMVersion), ProbeStatus.Health.RED); } if (jvmVersion.compareTo(new Version("17")) <= 0) { From 48a5bf8fa55e8ba3c839ccc1fece4e410b251e68 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Mon, 8 Jul 2024 17:35:58 +0200 Subject: [PATCH 03/13] Fixed detection of javascript engine --- .../sam/healthcheck/probes/SupportedStackJSModulesProbe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java index 9219cc0..2a81c57 100644 --- a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java +++ b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java @@ -41,7 +41,7 @@ public ProbeStatus getStatus() { if (jvmVersion.compareTo(new Version("17")) <= 0) { status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM with JVM version 17 or newer required (detected JVM version: %s)", jvmVersion), ProbeStatus.Health.RED); } - if (vmVendor.contains("GraalVM") && !isJavaScriptModuleInstalled()) { + if (!isJavaScriptModuleInstalled()) { status = ProbeStatusUtils.aggregateStatus(status, "GraalVM is detected but the JavaScript extension is not installed", ProbeStatus.Health.RED); } } From 77785c4c8d04d33627c63d507aa9d266e2955cf0 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Tue, 9 Jul 2024 10:18:08 +0200 Subject: [PATCH 04/13] Log all probes not returning green for the very first test executed on the platform --- .../cypress/e2e/api/jahiaErrors.spec.begin.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index 22e96b8..ff7c29c 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -3,16 +3,18 @@ import {healthCheck} from '../../support/gql'; describe('Jahia errors probe test', () => { it('Checks that JahiaErrors probe is functional', () => { healthCheck({severity: 'DEBUG'}).then(r => { - cy.log(JSON.stringify(r)); - const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); - expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); - expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); - - if (jahiaErrorsProbe.status.health === 'YELLOW') { - expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); - } else { - expect(jahiaErrorsProbe.status.message).to.contain('No errors are present on the platform'); - } + cy.log(JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.then(() => { + const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); + expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); + expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); + + if (jahiaErrorsProbe.status.health === 'YELLOW') { + expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); + } else { + expect(jahiaErrorsProbe.status.message).to.contain('No errors are present on the platform'); + } + }); }); }); From 6794dd6628dfccc34381a29701fe7d1358fc971d Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Tue, 9 Jul 2024 10:39:27 +0200 Subject: [PATCH 05/13] Fixed linting --- tests/cypress/e2e/api/jahiaErrors.spec.begin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index ff7c29c..a5d6ac0 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -8,12 +8,12 @@ describe('Jahia errors probe test', () => { const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); - + if (jahiaErrorsProbe.status.health === 'YELLOW') { expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); } else { expect(jahiaErrorsProbe.status.message).to.contain('No errors are present on the platform'); - } + } }); }); }); From 4e7e88da2639d6a8bdecc7ec6d1225b6e8ee827c Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Tue, 9 Jul 2024 14:20:09 +0200 Subject: [PATCH 06/13] Added logs --- .../cypress/e2e/api/jahiaErrors.spec.begin.ts | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index a5d6ac0..2b0a0bc 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -3,7 +3,7 @@ import {healthCheck} from '../../support/gql'; describe('Jahia errors probe test', () => { it('Checks that JahiaErrors probe is functional', () => { healthCheck({severity: 'DEBUG'}).then(r => { - cy.log(JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); cy.then(() => { const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); @@ -21,24 +21,30 @@ describe('Jahia errors probe test', () => { it('Check that Jahia errors probe is YELLOW when there is an error log', () => { cy.executeGroovy('groovy/simpleErrorLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - expect(r.status.health).to.eq('YELLOW'); - const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); - expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); - expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); - // Hard to predict exact number of errors - expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); - }); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.then(() => { + expect(r.status.health).to.eq('YELLOW'); + const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); + expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); + expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); + // Hard to predict exact number of errors + expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); + }); + }); }); it('Check that Jahia errors probe is YELLOW when there is a fatal log', () => { cy.executeGroovy('groovy/simpleFatalLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - expect(r.status.health).to.eq('YELLOW'); - const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); - expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); - expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); - // Hard to predict exact number of errors - expect(jahiaErrorsProbe.status.message).to.contains('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.then(() => { + expect(r.status.health).to.eq('YELLOW'); + const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); + expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); + expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); + // Hard to predict exact number of errors + expect(jahiaErrorsProbe.status.message).to.contains('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); + }); }); }); From e3562aceca88868adcf4dd7eb05ee6093718e5b7 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Tue, 9 Jul 2024 17:02:33 +0200 Subject: [PATCH 07/13] Fixed linting --- tests/cypress/e2e/api/jahiaErrors.spec.begin.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index 2b0a0bc..0c294d6 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -22,7 +22,7 @@ describe('Jahia errors probe test', () => { cy.executeGroovy('groovy/simpleErrorLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); - cy.then(() => { + cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); @@ -30,21 +30,21 @@ describe('Jahia errors probe test', () => { // Hard to predict exact number of errors expect(jahiaErrorsProbe.status.message).to.contain('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); }); - }); + }); }); it('Check that Jahia errors probe is YELLOW when there is a fatal log', () => { cy.executeGroovy('groovy/simpleFatalLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); - cy.then(() => { + cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.status.health).to.eq('YELLOW'); expect(jahiaErrorsProbe.severity).to.eq('DEBUG'); // Hard to predict exact number of errors expect(jahiaErrorsProbe.status.message).to.contains('errors are present on the platform, errors are not expected in a production environment and we recommend reviewing these.'); - }); + }); }); }); From b03e9e1ff79d79f923f19d6e1509d6d5623de70c Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 08:40:40 +0200 Subject: [PATCH 08/13] Added an initial test on SAM status --- tests/cypress.config.ts | 1 + .../cypress/e2e/api/jahiaErrors.spec.begin.ts | 6 ++--- .../cypress/e2e/api/testsStart.spec.begin.ts | 22 +++++++++++++++++++ .../groovy/logProvisioningDone.groovy | 1 + tests/package.json | 2 +- tests/yarn.lock | 8 +++---- 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 tests/cypress/e2e/api/testsStart.spec.begin.ts create mode 100644 tests/cypress/fixtures/groovy/logProvisioningDone.groovy diff --git a/tests/cypress.config.ts b/tests/cypress.config.ts index ac6b0e8..6761585 100644 --- a/tests/cypress.config.ts +++ b/tests/cypress.config.ts @@ -23,6 +23,7 @@ export default defineConfig({ }, excludeSpecPattern: '*.ignore.ts', specPattern: [ + 'cypress/e2e/api/testStart.spec.begin.ts', 'cypress/e2e/api/*.spec.begin.ts', 'cypress/e2e/api/*.spec.ts', 'cypress/e2e/api/shutdown.spec.final.ts' diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index 0c294d6..7862093 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -3,7 +3,7 @@ import {healthCheck} from '../../support/gql'; describe('Jahia errors probe test', () => { it('Checks that JahiaErrors probe is functional', () => { healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); @@ -21,7 +21,7 @@ describe('Jahia errors probe test', () => { it('Check that Jahia errors probe is YELLOW when there is an error log', () => { cy.executeGroovy('groovy/simpleErrorLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); @@ -36,7 +36,7 @@ describe('Jahia errors probe test', () => { it('Check that Jahia errors probe is YELLOW when there is a fatal log', () => { cy.executeGroovy('groovy/simpleFatalLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.data?.admin?.jahia?.healthCheck?.probes.filter(probe => probe.status?.health !== 'GREEN'))); + cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); diff --git a/tests/cypress/e2e/api/testsStart.spec.begin.ts b/tests/cypress/e2e/api/testsStart.spec.begin.ts new file mode 100644 index 0000000..264df31 --- /dev/null +++ b/tests/cypress/e2e/api/testsStart.spec.begin.ts @@ -0,0 +1,22 @@ +import {waitUntilSAMStatusGreen} from '@jahia/cypress'; +import {healthCheck} from '../../support/gql'; + +describe('Absence of errors in SAM at startup', () => { + it('Wait until SAM returns GREEN for medium severity', () => { + // The timeout of 3mn (180) is there to allow for the cluster to finish its synchronization + waitUntilSAMStatusGreen('MEDIUM', 180000); + cy.executeGroovy('groovy/logProvisioningDone.groovy'); + }); + + it('Check that SAM overall status is green for MEDIUM severity', () => { + healthCheck({severity: 'DEBUG'}).then(r => { + cy.log('Probes not GREEN with severity DEBUG: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); + }); + + healthCheck({severity: 'MEDIUM'}).then(r => { + cy.then(() => { + expect(r.status.health).to.eq('DEBUG'); + }); + }); + }); +}); \ No newline at end of file diff --git a/tests/cypress/fixtures/groovy/logProvisioningDone.groovy b/tests/cypress/fixtures/groovy/logProvisioningDone.groovy new file mode 100644 index 0000000..9e0cd54 --- /dev/null +++ b/tests/cypress/fixtures/groovy/logProvisioningDone.groovy @@ -0,0 +1 @@ +log.info("Jahia startup and provisioning is now complete, starting the Cypress tests") \ No newline at end of file diff --git a/tests/package.json b/tests/package.json index 3d6fa20..8faf83d 100644 --- a/tests/package.json +++ b/tests/package.json @@ -12,7 +12,7 @@ "main": "index.js", "license": "MIT", "devDependencies": { - "@jahia/cypress": "^3.18.1", + "@jahia/cypress": "^3.21.1", "@jahia/eslint-config": "^1.1.0", "@jahia/jahia-reporter": "^1.1.16", "@typescript-eslint/eslint-plugin": "^5.48.1", diff --git a/tests/yarn.lock b/tests/yarn.lock index ed84e24..a40e875 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -197,10 +197,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@jahia/cypress@^3.18.1": - version "3.18.1" - resolved "https://registry.yarnpkg.com/@jahia/cypress/-/cypress-3.18.1.tgz#b7445bce781b1c4603ecdcb8b6c33795933d6796" - integrity sha512-QnPAONPHiVzk9RknjFAdBDNUuQtqln0dceNogXJ/rLdXYNlul4/wQiVsOYN+PueZ7+dVM8hKd1mTF3zt1Sxr1Q== +"@jahia/cypress@^3.21.1": + version "3.21.1" + resolved "https://registry.yarnpkg.com/@jahia/cypress/-/cypress-3.21.1.tgz#501918cbda30d560326adc376c6b2126722f9217" + integrity sha512-ixsZ+LjsanTi+jDeLFxrZV9KPvijEgEpDq41bcl2/XA7JdAfxohENSGKjoqao1hO/AYEq5eOxx7sVnShWAngoA== dependencies: "@apollo/client" "^3.4.9" cypress-real-events "^1.11.0" From 1f950ab02959d5bb1ab418509bcc80ce622ae236 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 08:48:54 +0200 Subject: [PATCH 09/13] Improved test --- tests/cypress/e2e/api/jahiaErrors.spec.begin.ts | 3 --- tests/cypress/e2e/api/testsStart.spec.begin.ts | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts index 7862093..e3924f0 100644 --- a/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts +++ b/tests/cypress/e2e/api/jahiaErrors.spec.begin.ts @@ -3,7 +3,6 @@ import {healthCheck} from '../../support/gql'; describe('Jahia errors probe test', () => { it('Checks that JahiaErrors probe is functional', () => { healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); expect(jahiaErrorsProbe.description).to.contain('Count the number of errors faced by Jahia'); @@ -21,7 +20,6 @@ describe('Jahia errors probe test', () => { it('Check that Jahia errors probe is YELLOW when there is an error log', () => { cy.executeGroovy('groovy/simpleErrorLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); @@ -36,7 +34,6 @@ describe('Jahia errors probe test', () => { it('Check that Jahia errors probe is YELLOW when there is a fatal log', () => { cy.executeGroovy('groovy/simpleFatalLog.groovy'); healthCheck({severity: 'DEBUG'}).then(r => { - cy.log('Probes not returning GREEN: ' + JSON.stringify(r.probes.filter(probe => probe.status.health !== 'GREEN'))); cy.then(() => { expect(r.status.health).to.eq('YELLOW'); const jahiaErrorsProbe = r.probes.find(probe => probe.name === 'JahiaErrors'); diff --git a/tests/cypress/e2e/api/testsStart.spec.begin.ts b/tests/cypress/e2e/api/testsStart.spec.begin.ts index 264df31..3c8ff48 100644 --- a/tests/cypress/e2e/api/testsStart.spec.begin.ts +++ b/tests/cypress/e2e/api/testsStart.spec.begin.ts @@ -1,9 +1,13 @@ import {waitUntilSAMStatusGreen} from '@jahia/cypress'; import {healthCheck} from '../../support/gql'; +// This suite is there to ensure we get wait for SAM to return GREEN before starting the tests +// The goal is to wait for any provisioning activities that might be happening, in particular in cluster +// Failure of this suite highlights a potential issue with Jahia itself + describe('Absence of errors in SAM at startup', () => { it('Wait until SAM returns GREEN for medium severity', () => { - // The timeout of 3mn (180) is there to allow for the cluster to finish its synchronization + // The timeout of 3mn (180) is there to allow for the cluster (if present) to finish its synchronization waitUntilSAMStatusGreen('MEDIUM', 180000); cy.executeGroovy('groovy/logProvisioningDone.groovy'); }); @@ -19,4 +23,4 @@ describe('Absence of errors in SAM at startup', () => { }); }); }); -}); \ No newline at end of file +}); From fe56f66df677e6c186847b18407d6aa4af3580a4 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 10:20:55 +0200 Subject: [PATCH 10/13] Tweaked tests --- .../sam/healthcheck/probes/SupportedStackJSModulesProbe.java | 2 +- .../api/{testsStart.spec.begin.ts => firstCheck.spec.begin.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/cypress/e2e/api/{testsStart.spec.begin.ts => firstCheck.spec.begin.ts} (100%) diff --git a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java index 2a81c57..28b67e9 100644 --- a/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java +++ b/src/main/java/org/jahia/modules/sam/healthcheck/probes/SupportedStackJSModulesProbe.java @@ -35,7 +35,7 @@ public ProbeStatus getStatus() { } else if (System.getProperty("org.graalvm.version") == null) { status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM not detected on the environment (detected vendor: %s with JVM version: %s), after switching to GraalVM 22.3.3+ with JVM version 17+, make sure to enable the Javascript extension", vmVendor, jvmVersion), ProbeStatus.Health.RED); } else { - if (graalVMVersion.compareTo(new Version("22.3.3")) <= 0) { + if (graalVMVersion.compareTo(new Version("22.3")) <= 0) { status = ProbeStatusUtils.aggregateStatus(status, String.format("GraalVM version 22.3.3 or newer required (detected GraalVM version: %s)", graalVMVersion), ProbeStatus.Health.RED); } if (jvmVersion.compareTo(new Version("17")) <= 0) { diff --git a/tests/cypress/e2e/api/testsStart.spec.begin.ts b/tests/cypress/e2e/api/firstCheck.spec.begin.ts similarity index 100% rename from tests/cypress/e2e/api/testsStart.spec.begin.ts rename to tests/cypress/e2e/api/firstCheck.spec.begin.ts From b61ea27d5174edf5d37fdef380d683ef3c465ffd Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 10:47:44 +0200 Subject: [PATCH 11/13] Fixed typo --- tests/cypress/e2e/api/firstCheck.spec.begin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/e2e/api/firstCheck.spec.begin.ts b/tests/cypress/e2e/api/firstCheck.spec.begin.ts index 3c8ff48..d328b00 100644 --- a/tests/cypress/e2e/api/firstCheck.spec.begin.ts +++ b/tests/cypress/e2e/api/firstCheck.spec.begin.ts @@ -19,7 +19,7 @@ describe('Absence of errors in SAM at startup', () => { healthCheck({severity: 'MEDIUM'}).then(r => { cy.then(() => { - expect(r.status.health).to.eq('DEBUG'); + expect(r.status.health).to.eq('GREEN'); }); }); }); From 27b821836b33777b618292eeb33b1cdf0af49723 Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 17:20:27 +0200 Subject: [PATCH 12/13] Downgraded jahia-cypress version --- tests/package.json | 2 +- tests/yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/package.json b/tests/package.json index 8faf83d..69025b9 100644 --- a/tests/package.json +++ b/tests/package.json @@ -12,7 +12,7 @@ "main": "index.js", "license": "MIT", "devDependencies": { - "@jahia/cypress": "^3.21.1", + "@jahia/cypress": "^3.20.1", "@jahia/eslint-config": "^1.1.0", "@jahia/jahia-reporter": "^1.1.16", "@typescript-eslint/eslint-plugin": "^5.48.1", diff --git a/tests/yarn.lock b/tests/yarn.lock index a40e875..732bfcf 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -197,7 +197,7 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@jahia/cypress@^3.21.1": +"@jahia/cypress@^3.20.1": version "3.21.1" resolved "https://registry.yarnpkg.com/@jahia/cypress/-/cypress-3.21.1.tgz#501918cbda30d560326adc376c6b2126722f9217" integrity sha512-ixsZ+LjsanTi+jDeLFxrZV9KPvijEgEpDq41bcl2/XA7JdAfxohENSGKjoqao1hO/AYEq5eOxx7sVnShWAngoA== From 56304fd749abac37e95bddbbee6a2a3b73d90c0b Mon Sep 17 00:00:00 2001 From: "Francois G." Date: Wed, 10 Jul 2024 17:43:08 +0200 Subject: [PATCH 13/13] Updated jahia-cypress version --- tests/package.json | 2 +- tests/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/package.json b/tests/package.json index 69025b9..7a6091f 100644 --- a/tests/package.json +++ b/tests/package.json @@ -12,7 +12,7 @@ "main": "index.js", "license": "MIT", "devDependencies": { - "@jahia/cypress": "^3.20.1", + "@jahia/cypress": "3.20.1", "@jahia/eslint-config": "^1.1.0", "@jahia/jahia-reporter": "^1.1.16", "@typescript-eslint/eslint-plugin": "^5.48.1", diff --git a/tests/yarn.lock b/tests/yarn.lock index 732bfcf..955f843 100644 --- a/tests/yarn.lock +++ b/tests/yarn.lock @@ -197,10 +197,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@jahia/cypress@^3.20.1": - version "3.21.1" - resolved "https://registry.yarnpkg.com/@jahia/cypress/-/cypress-3.21.1.tgz#501918cbda30d560326adc376c6b2126722f9217" - integrity sha512-ixsZ+LjsanTi+jDeLFxrZV9KPvijEgEpDq41bcl2/XA7JdAfxohENSGKjoqao1hO/AYEq5eOxx7sVnShWAngoA== +"@jahia/cypress@3.20.1": + version "3.20.1" + resolved "https://registry.yarnpkg.com/@jahia/cypress/-/cypress-3.20.1.tgz#1897d752bc7beae3362e1d85d0f1b69cac5f5e41" + integrity sha512-f3hvwXSzSPCU42z34sJ+BjZFXvmkqRq7k3cJfac/HNLrM33y7oWYpp2Nvape1W111y9WFREWLMN8iRZB+y7l0Q== dependencies: "@apollo/client" "^3.4.9" cypress-real-events "^1.11.0"