@webex/plugin-meetings 3.0.0-beta.261 → 3.0.0-beta.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -328,8 +328,6 @@ describe('getReachabilityResults', () => {
328
328
 
329
329
  beforeEach(() => {
330
330
  webex = new MockWebex();
331
-
332
- // sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
333
331
  });
334
332
 
335
333
  afterEach(() => {
@@ -416,3 +414,211 @@ describe('getReachabilityResults', () => {
416
414
  );
417
415
  });
418
416
  });
417
+
418
+ describe('getReachabilityMetrics', () => {
419
+ let webex;
420
+
421
+ beforeEach(() => {
422
+ webex = new MockWebex();
423
+ });
424
+
425
+ afterEach(() => {
426
+ sinon.restore();
427
+ });
428
+
429
+ const runCheck = async (mockStorage: any, expectedResult: any) => {
430
+ if (mockStorage) {
431
+ await webex.boundedStorage.put(
432
+ 'Reachability',
433
+ 'reachability.result',
434
+ JSON.stringify(mockStorage)
435
+ );
436
+ }
437
+ const reachability = new Reachability(webex);
438
+ const result = await reachability.getReachabilityMetrics();
439
+
440
+ assert.deepEqual(result, expectedResult);
441
+ };
442
+
443
+ it('returns all zeros if reading from local storage fails', async () => {
444
+ sinon.stub(webex.boundedStorage, 'get').rejects(new Error('fake error'));
445
+
446
+ const reachability = new Reachability(webex);
447
+
448
+ const result = await reachability.getReachabilityMetrics();
449
+
450
+ assert.deepEqual(result, {
451
+ reachability_public_udp_success: 0,
452
+ reachability_public_udp_failed: 0,
453
+ reachability_public_tcp_success: 0,
454
+ reachability_public_tcp_failed: 0,
455
+ reachability_vmn_udp_success: 0,
456
+ reachability_vmn_udp_failed: 0,
457
+ reachability_vmn_tcp_success: 0,
458
+ reachability_vmn_tcp_failed: 0,
459
+ });
460
+ });
461
+
462
+ it('returns correct stats based on local storage results', async () => {
463
+ await runCheck(
464
+ // mock storage:
465
+ {
466
+ public1: {
467
+ udp: {reachable: 'true', latencyInMilliseconds: '100'},
468
+ tcp: {untested: 'true'},
469
+ xtls: {untested: 'true'},
470
+ },
471
+ vmn1: {
472
+ udp: {reachable: 'true', latencyInMilliseconds: '200'},
473
+ tcp: {reachable: 'false'},
474
+ xtls: {untested: 'true'},
475
+ isVideoMesh: true,
476
+ },
477
+ vmn2: {
478
+ udp: {untested: 'true'},
479
+ tcp: {reachable: 'true', latencyInMilliseconds: '100', clientMediaIPs: ['10.10.10.10']},
480
+ xtls: {untested: 'true'},
481
+ isVideoMesh: true,
482
+ someOtherField: 'any value',
483
+ },
484
+ public2: {
485
+ udp: {reachable: 'false', latencyInMilliseconds: '300'},
486
+ tcp: {reachable: 'false', untested: 'true'},
487
+ xtls: {untested: 'true'},
488
+ someOtherField: 'any value',
489
+ },
490
+ public3: {
491
+ udp: {reachable: 'true', latencyInMilliseconds: '400', clientMediaIPs: ['10.10.10.10']},
492
+ tcp: {reachable: 'true', latencyInMilliseconds: '100', clientMediaIPs: ['10.10.10.10']},
493
+ xtls: {untested: 'true'},
494
+ isVideoMesh: false,
495
+ someOtherField: 'any value',
496
+ },
497
+ public4: {
498
+ udp: {reachable: 'true', latencyInMilliseconds: '40', clientMediaIPs: ['10.10.10.11']},
499
+ tcp: {reachable: 'true', latencyInMilliseconds: '100', clientMediaIPs: ['10.10.10.11']},
500
+ xtls: {untested: 'true'},
501
+ isVideoMesh: false,
502
+ someOtherField: 'any value',
503
+ },
504
+ public5: {
505
+ udp: {reachable: 'false'},
506
+ tcp: {untested: 'true'},
507
+ xtls: {untested: 'true'},
508
+ isVideoMesh: false,
509
+ someOtherField: 'any value',
510
+ },
511
+ },
512
+ // expected result:
513
+ {
514
+ reachability_public_udp_success: 3,
515
+ reachability_public_udp_failed: 2,
516
+ reachability_public_tcp_success: 2,
517
+ reachability_public_tcp_failed: 1,
518
+ reachability_vmn_udp_success: 1,
519
+ reachability_vmn_udp_failed: 0,
520
+ reachability_vmn_tcp_success: 1,
521
+ reachability_vmn_tcp_failed: 1,
522
+ }
523
+ );
524
+ });
525
+
526
+ it('returns correct stats when only public nodes were tested', async () => {
527
+ await runCheck(
528
+ // mock storage:
529
+ {
530
+ public1: {
531
+ udp: {reachable: 'true', latencyInMilliseconds: '400', clientMediaIPs: ['10.10.10.10']},
532
+ tcp: {reachable: 'true', latencyInMilliseconds: '100', clientMediaIPs: ['10.10.10.10']},
533
+ xtls: {untested: 'true'},
534
+ isVideoMesh: false,
535
+ },
536
+ public2: {
537
+ udp: {reachable: 'true', latencyInMilliseconds: '100'},
538
+ tcp: {untested: 'true'},
539
+ xtls: {untested: 'true'},
540
+ },
541
+ public3: {
542
+ udp: {reachable: 'false', latencyInMilliseconds: '300'},
543
+ tcp: {reachable: 'false', untested: 'true'},
544
+ xtls: {untested: 'true'},
545
+ someOtherField: 'any value',
546
+ },
547
+ public4: {
548
+ udp: {untested: 'true'},
549
+ tcp: {reachable: 'false'},
550
+ xtls: {untested: 'true'},
551
+ isVideoMesh: false,
552
+ someOtherField: 'any value',
553
+ },
554
+ public5: {
555
+ udp: {reachable: 'true', latencyInMilliseconds: '400', clientMediaIPs: ['10.10.10.10']},
556
+ tcp: {untested: 'true'},
557
+ xtls: {untested: 'true'},
558
+ },
559
+ },
560
+ // expected result:
561
+ {
562
+ reachability_public_udp_success: 3,
563
+ reachability_public_udp_failed: 1,
564
+ reachability_public_tcp_success: 1,
565
+ reachability_public_tcp_failed: 2,
566
+ reachability_vmn_udp_success: 0,
567
+ reachability_vmn_udp_failed: 0,
568
+ reachability_vmn_tcp_success: 0,
569
+ reachability_vmn_tcp_failed: 0,
570
+ }
571
+ );
572
+ });
573
+
574
+ it('returns correct stats when only video mesh nodes were tested', async () => {
575
+ await runCheck(
576
+ // mock storage:
577
+ {
578
+ vmn1: {
579
+ udp: {reachable: 'false'},
580
+ tcp: {reachable: 'true', latencyInMilliseconds: '100', clientMediaIPs: ['10.10.10.10']},
581
+ xtls: {untested: 'true'},
582
+ isVideoMesh: true,
583
+ },
584
+ vmn2: {
585
+ udp: {reachable: 'true', latencyInMilliseconds: '200', clientMediaIPs: ['10.10.10.10']},
586
+ tcp: {untested: 'true'},
587
+ xtls: {untested: 'true'},
588
+ isVideoMesh: true,
589
+ },
590
+ vmn3: {
591
+ udp: {reachable: 'true', latencyInMilliseconds: '300', clientMediaIPs: ['10.10.10.10']},
592
+ tcp: {reachable: 'false', untested: 'true'},
593
+ xtls: {untested: 'true'},
594
+ isVideoMesh: true,
595
+ },
596
+ vmn4: {
597
+ udp: {untested: 'true'},
598
+ tcp: {reachable: 'false'},
599
+ xtls: {untested: 'true'},
600
+ isVideoMesh: true,
601
+ someOtherField: 'any value',
602
+ },
603
+ vmn5: {
604
+ udp: {reachable: 'true', latencyInMilliseconds: '200', clientMediaIPs: ['10.10.10.10']},
605
+ tcp: {reachable: 'false'},
606
+ xtls: {untested: 'true'},
607
+ isVideoMesh: true,
608
+ someOtherField: 'any value',
609
+ },
610
+ },
611
+ // expected result:
612
+ {
613
+ reachability_public_udp_success: 0,
614
+ reachability_public_udp_failed: 0,
615
+ reachability_public_tcp_success: 0,
616
+ reachability_public_tcp_failed: 0,
617
+ reachability_vmn_udp_success: 3,
618
+ reachability_vmn_udp_failed: 1,
619
+ reachability_vmn_tcp_success: 1,
620
+ reachability_vmn_tcp_failed: 3,
621
+ }
622
+ );
623
+ });
624
+ });