@@ -4,7 +4,6 @@ import sinon from 'sinon';
4
4
import EventEmitter from 'events' ;
5
5
import testUtils from '../../../utils/testUtils' ;
6
6
import Reachability , {
7
- ReachabilityResults ,
8
7
ReachabilityResultsForBackend ,
9
8
} from '@webex/plugin-meetings/src/reachability/' ;
10
9
import { ClusterNode } from '../../../../src/reachability/request' ;
@@ -507,6 +506,11 @@ describe('gatherReachability', () => {
507
506
mockClusterReachabilityInstances [ id ] = mockInstance ;
508
507
return mockInstance ;
509
508
} ) ;
509
+
510
+ webex . config . meetings . experimental = {
511
+ enableTcpReachability : false ,
512
+ enableTlsReachability : false ,
513
+ } ;
510
514
} ) ;
511
515
512
516
afterEach ( ( ) => {
@@ -1044,13 +1048,14 @@ describe('gatherReachability', () => {
1044
1048
enableTlsReachability : true ,
1045
1049
} ;
1046
1050
1047
- // the metrics related to ipver are not tested in these tests and are all the same, so setting them up here
1051
+ // the metrics related to ipver and trigger are not tested in these tests and are all the same, so setting them up here
1048
1052
const expectedMetricsFull = {
1049
1053
...expectedMetrics ,
1050
1054
ipver_firstIpV4 : - 1 ,
1051
1055
ipver_firstIpV6 : - 1 ,
1052
1056
ipver_firstMdns : - 1 ,
1053
1057
ipver_totalTime : - 1 ,
1058
+ trigger : 'test' ,
1054
1059
} ;
1055
1060
1056
1061
const receivedEvents = {
@@ -1082,7 +1087,7 @@ describe('gatherReachability', () => {
1082
1087
1083
1088
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( mockGetClustersResult ) ;
1084
1089
1085
- const resultPromise = reachability . gatherReachability ( ) ;
1090
+ const resultPromise = reachability . gatherReachability ( 'test' ) ;
1086
1091
1087
1092
await testUtils . flushPromises ( ) ;
1088
1093
@@ -1142,6 +1147,38 @@ describe('gatherReachability', () => {
1142
1147
} )
1143
1148
) ;
1144
1149
1150
+ it ( 'sends the trigger parameter in the metrics' , async ( ) => {
1151
+ const reachability = new TestReachability ( webex ) ;
1152
+
1153
+ const mockGetClustersResult = {
1154
+ clusters : {
1155
+ clusterA : {
1156
+ udp : [ 'udp-url' ] ,
1157
+ tcp : [ ] ,
1158
+ xtls : [ ] ,
1159
+ isVideoMesh : false ,
1160
+ } ,
1161
+ } ,
1162
+ joinCookie : { id : 'id' } ,
1163
+ } ;
1164
+
1165
+ reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( mockGetClustersResult ) ;
1166
+
1167
+ const resultPromise = reachability . gatherReachability ( 'some trigger' ) ;
1168
+
1169
+ // let it time out
1170
+ await testUtils . flushPromises ( ) ;
1171
+ clock . tick ( 15000 ) ;
1172
+ await resultPromise ;
1173
+
1174
+ // check the metric contains the right trigger value
1175
+ assert . calledWith (
1176
+ Metrics . sendBehavioralMetric ,
1177
+ 'js_sdk_reachability_completed' ,
1178
+ sinon . match ( { trigger : 'some trigger' } )
1179
+ ) ;
1180
+ } ) ;
1181
+
1145
1182
it ( `starts ip network version detection and includes the results in the metrics` , async ( ) => {
1146
1183
webex . config . meetings . experimental = {
1147
1184
enableTcpReachability : true ,
@@ -1180,7 +1217,7 @@ describe('gatherReachability', () => {
1180
1217
joinCookie : { id : 'id' } ,
1181
1218
} ) ;
1182
1219
1183
- const resultPromise = reachability . gatherReachability ( ) ;
1220
+ const resultPromise = reachability . gatherReachability ( 'test' ) ;
1184
1221
1185
1222
await testUtils . flushPromises ( ) ;
1186
1223
@@ -1217,6 +1254,7 @@ describe('gatherReachability', () => {
1217
1254
ipver_firstIpV6 : webex . internal . device . ipNetworkDetector . firstIpV6 ,
1218
1255
ipver_firstMdns : webex . internal . device . ipNetworkDetector . firstMdns ,
1219
1256
ipver_totalTime : webex . internal . device . ipNetworkDetector . totalTime ,
1257
+ trigger : 'test' ,
1220
1258
} ) ;
1221
1259
} ) ;
1222
1260
@@ -1248,7 +1286,7 @@ describe('gatherReachability', () => {
1248
1286
1249
1287
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( mockGetClustersResult ) ;
1250
1288
1251
- const resultPromise = reachability . gatherReachability ( ) ;
1289
+ const resultPromise = reachability . gatherReachability ( 'test' ) ;
1252
1290
1253
1291
await testUtils . flushPromises ( ) ;
1254
1292
@@ -1341,7 +1379,7 @@ describe('gatherReachability', () => {
1341
1379
1342
1380
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( mockGetClustersResult ) ;
1343
1381
1344
- const resultPromise = reachability . gatherReachability ( ) ;
1382
+ const resultPromise = reachability . gatherReachability ( 'test' ) ;
1345
1383
1346
1384
await testUtils . flushPromises ( ) ;
1347
1385
@@ -1382,7 +1420,7 @@ describe('gatherReachability', () => {
1382
1420
1383
1421
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . throws ( ) ;
1384
1422
1385
- const result = await reachability . gatherReachability ( ) ;
1423
+ const result = await reachability . gatherReachability ( 'test' ) ;
1386
1424
1387
1425
assert . empty ( result ) ;
1388
1426
@@ -1400,7 +1438,7 @@ describe('gatherReachability', () => {
1400
1438
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( getClustersResult ) ;
1401
1439
( reachability as any ) . performReachabilityChecks = sinon . stub ( ) . throws ( ) ;
1402
1440
1403
- const result = await reachability . gatherReachability ( ) ;
1441
+ const result = await reachability . gatherReachability ( 'test' ) ;
1404
1442
1405
1443
assert . empty ( result ) ;
1406
1444
@@ -1435,7 +1473,7 @@ describe('gatherReachability', () => {
1435
1473
1436
1474
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( getClustersResult ) ;
1437
1475
1438
- const promise = reachability . gatherReachability ( ) ;
1476
+ const promise = reachability . gatherReachability ( 'test' ) ;
1439
1477
1440
1478
await simulateTimeout ( ) ;
1441
1479
await promise ;
@@ -1481,7 +1519,7 @@ describe('gatherReachability', () => {
1481
1519
1482
1520
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( getClustersResult ) ;
1483
1521
1484
- const promise = reachability . gatherReachability ( ) ;
1522
+ const promise = reachability . gatherReachability ( 'test' ) ;
1485
1523
await simulateTimeout ( ) ;
1486
1524
await promise ;
1487
1525
@@ -1515,7 +1553,7 @@ describe('gatherReachability', () => {
1515
1553
1516
1554
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( getClustersResult ) ;
1517
1555
1518
- const promise = reachability . gatherReachability ( ) ;
1556
+ const promise = reachability . gatherReachability ( 'test' ) ;
1519
1557
1520
1558
await simulateTimeout ( ) ;
1521
1559
await promise ;
@@ -1550,7 +1588,7 @@ describe('gatherReachability', () => {
1550
1588
1551
1589
reachability . reachabilityRequest . getClusters = sinon . stub ( ) . returns ( getClustersResult ) ;
1552
1590
1553
- const promise = reachability . gatherReachability ( ) ;
1591
+ const promise = reachability . gatherReachability ( 'test' ) ;
1554
1592
1555
1593
await simulateTimeout ( ) ;
1556
1594
await promise ;
@@ -1595,7 +1633,7 @@ describe('gatherReachability', () => {
1595
1633
return getClustersResult ;
1596
1634
} ) ;
1597
1635
1598
- const promise = reachability . gatherReachability ( ) ;
1636
+ const promise = reachability . gatherReachability ( 'test' ) ;
1599
1637
1600
1638
await simulateTimeout ( ) ;
1601
1639
await promise ;
@@ -1616,7 +1654,7 @@ describe('gatherReachability', () => {
1616
1654
throw new Error ( 'fake error' ) ;
1617
1655
} ) ;
1618
1656
1619
- const promise = reachability . gatherReachability ( ) ;
1657
+ const promise = reachability . gatherReachability ( 'test' ) ;
1620
1658
1621
1659
await simulateTimeout ( ) ;
1622
1660
0 commit comments