@@ -21,7 +21,6 @@ import {
21
21
} from "../../../src" ;
22
22
import { sleep } from "../../../src/utils/NodeJS.util" ;
23
23
import { LockStatus } from "../../../src/types/lock/UnlockResponse" ;
24
- import { Settings } from "../../../src/utils/Settings.util" ;
25
24
26
25
const daprHost = "127.0.0.1" ;
27
26
const daprGrpcPort = "50000" ;
@@ -558,128 +557,3 @@ describe("common/client", () => {
558
557
} ) ;
559
558
} ) ;
560
559
} ) ;
561
-
562
- describe ( "http/client with environment variables" , ( ) => {
563
- let client : DaprClient ;
564
-
565
- // We need to start listening on some endpoints already
566
- // this because Dapr is not dynamic and registers endpoints on boot
567
- // we put a timeout of 10s since it takes around 4s for Dapr to boot up
568
-
569
- afterAll ( async ( ) => {
570
- await client . stop ( ) ;
571
- } ) ;
572
-
573
- it ( "should give preference to host and port in constructor arguments over endpoint environment variables " , async ( ) => {
574
- process . env . DAPR_HTTP_ENDPOINT = "https://httpdomain.com" ;
575
- process . env . DAPR_GRPC_ENDPOINT = "https://grpcdomain.com" ;
576
-
577
- client = new DaprClient ( {
578
- daprHost,
579
- daprPort : daprHttpPort ,
580
- communicationProtocol : CommunicationProtocolEnum . HTTP ,
581
- isKeepAlive : false ,
582
- } ) ;
583
-
584
- expect ( client . options . daprHost ) . toEqual ( daprHost ) ;
585
- expect ( client . options . daprPort ) . toEqual ( daprHttpPort ) ;
586
-
587
- client = new DaprClient ( {
588
- daprHost,
589
- daprPort : daprGrpcPort ,
590
- communicationProtocol : CommunicationProtocolEnum . GRPC ,
591
- isKeepAlive : false ,
592
- } ) ;
593
-
594
- expect ( client . options . daprHost ) . toEqual ( daprHost ) ;
595
- expect ( client . options . daprPort ) . toEqual ( daprGrpcPort ) ;
596
- } ) ;
597
-
598
- it ( "should give preference to port with no host in constructor arguments over environment variables " , async ( ) => {
599
- process . env . DAPR_HTTP_ENDPOINT = "https://httpdomain.com" ;
600
- process . env . DAPR_GRPC_ENDPOINT = "https://grpcdomain.com" ;
601
-
602
- client = new DaprClient ( {
603
- daprPort : daprHttpPort ,
604
- communicationProtocol : CommunicationProtocolEnum . HTTP ,
605
- isKeepAlive : false ,
606
- } ) ;
607
-
608
- expect ( client . options . daprHost ) . toEqual ( Settings . getDefaultHost ( ) ) ;
609
- expect ( client . options . daprPort ) . toEqual ( daprHttpPort ) ;
610
-
611
- client = new DaprClient ( {
612
- daprPort : daprGrpcPort ,
613
- communicationProtocol : CommunicationProtocolEnum . GRPC ,
614
- isKeepAlive : false ,
615
- } ) ;
616
-
617
- expect ( client . options . daprHost ) . toEqual ( Settings . getDefaultHost ( ) ) ;
618
- expect ( client . options . daprPort ) . toEqual ( daprGrpcPort ) ;
619
- } ) ;
620
-
621
- it ( "should give preference to host with no port in constructor arguments over environment variables " , async ( ) => {
622
- process . env . DAPR_HTTP_ENDPOINT = "https://httpdomain.com" ;
623
- process . env . DAPR_GRPC_ENDPOINT = "https://grpcdomain.com" ;
624
-
625
- client = new DaprClient ( {
626
- daprHost : daprHost ,
627
- communicationProtocol : CommunicationProtocolEnum . HTTP ,
628
- isKeepAlive : false ,
629
- } ) ;
630
-
631
- expect ( client . options . daprHost ) . toEqual ( daprHost ) ;
632
- expect ( client . options . daprPort ) . toEqual ( Settings . getDefaultPort ( CommunicationProtocolEnum . HTTP ) ) ;
633
-
634
- client = new DaprClient ( {
635
- daprHost : daprHost ,
636
- communicationProtocol : CommunicationProtocolEnum . GRPC ,
637
- isKeepAlive : false ,
638
- } ) ;
639
-
640
- expect ( client . options . daprHost ) . toEqual ( daprHost ) ;
641
- expect ( client . options . daprPort ) . toEqual ( Settings . getDefaultPort ( CommunicationProtocolEnum . GRPC ) ) ;
642
- } ) ;
643
-
644
- it ( "should use environment variable endpoint for HTTP" , async ( ) => {
645
- process . env . DAPR_HTTP_ENDPOINT = "https://httpdomain.com" ;
646
- client = new DaprClient ( {
647
- communicationProtocol : CommunicationProtocolEnum . HTTP ,
648
- isKeepAlive : false ,
649
- } ) ;
650
-
651
- expect ( client . options . daprHost ) . toEqual ( "https://httpdomain.com" ) ;
652
- expect ( client . options . daprPort ) . toEqual ( "443" ) ;
653
- } ) ;
654
-
655
- it ( "should use environment variable endpoint for GRPC" , async ( ) => {
656
- process . env . DAPR_GRPC_ENDPOINT = "https://grpcdomain.com" ;
657
- client = new DaprClient ( {
658
- communicationProtocol : CommunicationProtocolEnum . GRPC ,
659
- isKeepAlive : false ,
660
- } ) ;
661
-
662
- expect ( client . options . daprHost ) . toEqual ( "https://grpcdomain.com" ) ;
663
- expect ( client . options . daprPort ) . toEqual ( "443" ) ;
664
- } ) ;
665
-
666
- it ( "should use default host and port when no other parameters provided" , async ( ) => {
667
- process . env . DAPR_HTTP_ENDPOINT = "" ;
668
- process . env . DAPR_GRPC_ENDPOINT = "" ;
669
- client = new DaprClient ( {
670
- communicationProtocol : CommunicationProtocolEnum . HTTP ,
671
- isKeepAlive : false ,
672
- } ) ;
673
-
674
- expect ( client . options . daprHost ) . toEqual ( Settings . getDefaultHost ( ) ) ;
675
- expect ( client . options . daprPort ) . toEqual ( Settings . getDefaultPort ( CommunicationProtocolEnum . HTTP ) ) ;
676
-
677
- client = new DaprClient ( {
678
- communicationProtocol : CommunicationProtocolEnum . GRPC ,
679
- isKeepAlive : false ,
680
- } ) ;
681
-
682
- expect ( client . options . daprHost ) . toEqual ( Settings . getDefaultHost ( ) ) ;
683
- expect ( client . options . daprPort ) . toEqual ( Settings . getDefaultPort ( CommunicationProtocolEnum . GRPC ) ) ;
684
- } ) ;
685
- } ) ;
0 commit comments