diff --git a/tests/qa-integration/pmm_psmdb_integration_test.js b/tests/qa-integration/pmm_psmdb_integration_test.js index 0323ad59c..d1a4443c7 100644 --- a/tests/qa-integration/pmm_psmdb_integration_test.js +++ b/tests/qa-integration/pmm_psmdb_integration_test.js @@ -13,6 +13,7 @@ Before(async ({ I, settingsAPI }) => { const version = process.env.PSMDB_VERSION ? `${process.env.PSMDB_VERSION}` : '4.4'; const replica_container_name = `psmdb_pmm_${version}_replica`; const regular_container_name = `psmdb_pmm_${version}_regular`; +const arbiter_container_name = `psmdb_pmm_${version}_arbiter`; const remoteServiceName = 'remote_pmm-psmdb-integration'; const connection = { @@ -171,3 +172,28 @@ Scenario( I.assertEqual(numberOfVisibleElements,1 , "No of ARBITER elements for ReplicatSet are not as expected"); }, ); + +Scenario( + 'T2317 Verify Wrong Replication Lag by Set values if RS is PSA -( MongoDB Cluster Summary) @pmm-psmdb-arbiter-integration @not-ui-pipeline', + async ({ + I, dashboardPage, adminPage, + }) => { + + I.amOnPage(`${dashboardPage.mongodbReplicaSetSummaryDashboard.url}&var-replset=rs1`); + dashboardPage.waitForDashboardOpened(); + + // Grab secs or year lag value from Replication Lag min field in UI + const replLagLocator = '(//a[@data-testid=\'data-testid dashboard-row-title-Replication Lag\']/following::a[contains(text(),\'mongodb_rs2_1\')]/following::td[contains(text(),\' s\') or contains(text(),\' year\')])[1]'; + + // Get the text content of the element located + const replLagText = await I.grabTextFrom(replLagLocator); + // Grab only Lag value required from Text + let actualLagValue= +replLagText.split(".",1); + // Grab actual Lag value required from database + let expectedLagValue = (await I.verifyCommand(`docker exec -w /mongosh/bin/ ${arbiter_container_name} ./mongosh --eval rs\.printSecondaryReplicationInfo\\(\\) | awk '/replLag:/ {print $2}' | cut -c 2`)).trim(); + // Give some threshold increase for actual replication lag, for now 2 secs extra + expectedLagValue = +expectedLagValue+2; + I.assertBelow(actualLagValue,expectedLagValue, "ReplicaLag is more than expected lag vaule"); + }, +); +