@@ -169,27 +169,41 @@ Scenario.skip(
169
169
} ,
170
170
) . retry ( 2 ) ;
171
171
172
- Scenario . skip (
173
- 'T2317 Verify Wrong Replication Lag by Set values if RS is PSA -( MongoDB Cluster Summary) @pmm-psmdb-arbiter-integration @not-ui-pipeline' ,
172
+ Scenario (
173
+ 'T1775, T1888 Verify Wrong Replication Lag by Set values if RS is PSA -( MongoDB Cluster Summary) @pmm-psmdb-arbiter-integration @not-ui-pipeline' ,
174
174
async ( {
175
175
I, dashboardPage,
176
176
} ) => {
177
177
I . amOnPage ( `${ dashboardPage . mongodbReplicaSetSummaryDashboard . url } &var-replset=rs1` ) ;
178
178
dashboardPage . waitForDashboardOpened ( ) ;
179
179
180
- // Grab secs or year lag value from Replication Lag min field in UI
181
- 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]' ;
180
+ const username = 'dba' ;
181
+ const password = 'test1234' ;
182
+
183
+ // Gather Secondary member Service Name from Mongo and PMM admin
184
+ const secondaryLagPort = ( await I . verifyCommand ( `docker exec ${ arbiter_container_name } ./psmdb_${ version } /bin/mongo --eval rs\.printSecondaryReplicationInfo\\(\\) --username=${ username } --password=${ password } | awk -F ":" '/source/ {print $3}'` ) ) . trim ( ) ;
185
+ const serviceName = ( await I . verifyCommand ( `docker exec ${ arbiter_container_name } pmm-admin list | awk -v pat='${ secondaryLagPort } ' '$0~pat {print $2}'` ) ) . trim ( ) ;
186
+
187
+ // Check if logs has arbiter connection
188
+ await I . asyncWaitFor ( async ( ) => {
189
+ const checkLog = await I . verifyCommand ( `docker exec ${ arbiter_container_name } grep -q "level=warning.*some metrics might be unavailable on arbiter nodes" pmm-agent.log; echo $?` ) ;
190
+
191
+ return checkLog ;
192
+ } , 60 ) ;
182
193
183
- await I . waitForElement ( replLagLocator , 500 ) ;
184
- // Get the text content of the element located
185
- const replLagText = await I . grabTextFrom ( replLagLocator ) ;
186
- // Grab only Lag value required from Text
187
- const actualLagValue = + replLagText . split ( '.' , 1 ) ;
188
- // Grab actual Lag value required from database
189
- 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 ( ) ;
194
+ // Check if there are no errors but only warnings
195
+ let errorCode = 0 ;
190
196
191
- // Give some threshold increase for actual replication lag, for now 2 secs extra
192
- expectedLagValue = + expectedLagValue + 2 ;
193
- I . assertBelow ( actualLagValue , expectedLagValue , 'ReplicaLag is more than expected lag vaule' ) ;
197
+ errorCode = ( await I . verifyCommand ( `docker exec ${ arbiter_container_name } grep -q "level=error.*some metrics might be unavailable on arbiter nodes" pmm-agent.log; echo $?` ) ) ;
198
+ I . assertTrue ( errorCode . includes ( 1 ) , `No errors for arbiter setup expected but got error code: ${ errorCode } ` ) ;
199
+
200
+ const replLagServiceName = dashboardPage . graphLegendSeriesValue ( 'Replication Lag' , 'mongodb_rs2_1_1519' ) ;
201
+ const replLagSeriesValue = `${ replLagServiceName . toXPath ( ) } /following::td[contains(text(),'year')]` ;
202
+
203
+ // Check service name from Replication Lag field in UI
204
+ await I . waitForElement ( replLagServiceName , 180 ) ;
205
+
206
+ // Check lag value from Replication Lag field is not 'year' in UI
207
+ await I . dontSeeElement ( replLagSeriesValue , 180 ) ;
194
208
} ,
195
- ) ;
209
+ ) . retry ( 1 ) ;
0 commit comments