@@ -542,6 +542,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
542
542
"Status": "critical",
543
543
"Notes": "Http based health check",
544
544
"Output": "",
545
+ "Type": "http",
545
546
"ServiceID": "",
546
547
"ServiceName": "",
547
548
"Definition": {
@@ -564,6 +565,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
564
565
"Status": "passing",
565
566
"Notes": "Http based health check",
566
567
"Output": "success",
568
+ "Type": "http",
567
569
"ServiceID": "",
568
570
"ServiceName": "",
569
571
"Definition": {
@@ -586,6 +588,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
586
588
"Status": "passing",
587
589
"Notes": "Http based health check",
588
590
"Output": "success",
591
+ "Type": "http",
589
592
"ServiceID": "",
590
593
"ServiceName": "",
591
594
"ExposedPort": 5678,
@@ -624,6 +627,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
624
627
Name : "Node http check" ,
625
628
Status : api .HealthCritical ,
626
629
Notes : "Http based health check" ,
630
+ Type : "http" ,
627
631
Definition : structs.HealthCheckDefinition {
628
632
Interval : 6 * time .Second ,
629
633
Timeout : 6 * time .Second ,
@@ -646,6 +650,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
646
650
Status : api .HealthPassing ,
647
651
Notes : "Http based health check" ,
648
652
Output : "success" ,
653
+ Type : "http" ,
649
654
Definition : structs.HealthCheckDefinition {
650
655
Interval : 10 * time .Second ,
651
656
Timeout : 10 * time .Second ,
@@ -668,6 +673,7 @@ func TestTxnEndpoint_UpdateCheck(t *testing.T) {
668
673
Status : api .HealthPassing ,
669
674
Notes : "Http based health check" ,
670
675
Output : "success" ,
676
+ Type : "http" ,
671
677
ExposedPort : 5678 ,
672
678
Definition : structs.HealthCheckDefinition {
673
679
Interval : 15 * time .Second ,
@@ -712,6 +718,23 @@ func TestTxnEndpoint_NodeService(t *testing.T) {
712
718
}
713
719
}
714
720
},
721
+ {
722
+ "Service": {
723
+ "Verb": "set",
724
+ "Node": "%s",
725
+ "Service": {
726
+ "Service": "test2",
727
+ "Address": "192.168.0.10",
728
+ "Port" : 8080,
729
+ "TaggedAddresses": {
730
+ "lan": {
731
+ "Address": "192.168.0.10",
732
+ "Port": 8080
733
+ }
734
+ }
735
+ }
736
+ }
737
+ },
715
738
{
716
739
"Service": {
717
740
"Verb": "set",
@@ -736,7 +759,7 @@ func TestTxnEndpoint_NodeService(t *testing.T) {
736
759
}
737
760
}
738
761
]
739
- ` , a .config .NodeName , a .config .NodeName )))
762
+ ` , a .config .NodeName , a .config .NodeName , a . config . NodeName )))
740
763
req , _ := http .NewRequest ("PUT" , "/v1/txn" , buf )
741
764
resp := httptest .NewRecorder ()
742
765
obj , err := a .srv .Txn (resp , req )
@@ -747,7 +770,7 @@ func TestTxnEndpoint_NodeService(t *testing.T) {
747
770
if ! ok {
748
771
t .Fatalf ("bad type: %T" , obj )
749
772
}
750
- require .Equal (t , 2 , len (txnResp .Results ))
773
+ require .Equal (t , 3 , len (txnResp .Results ))
751
774
752
775
index := txnResp .Results [0 ].Service .ModifyIndex
753
776
expected := structs.TxnResponse {
@@ -768,6 +791,29 @@ func TestTxnEndpoint_NodeService(t *testing.T) {
768
791
EnterpriseMeta : * structs .DefaultEnterpriseMetaInDefaultPartition (),
769
792
},
770
793
},
794
+ & structs.TxnResult {
795
+ Service : & structs.NodeService {
796
+ Service : "test2" ,
797
+ ID : "test2" ,
798
+ Address : "192.168.0.10" ,
799
+ Port : 8080 ,
800
+ TaggedAddresses : map [string ]structs.ServiceAddress {
801
+ "lan" : {
802
+ Address : "192.168.0.10" ,
803
+ Port : 8080 ,
804
+ },
805
+ },
806
+ Weights : & structs.Weights {
807
+ Passing : 1 ,
808
+ Warning : 1 ,
809
+ },
810
+ RaftIndex : structs.RaftIndex {
811
+ CreateIndex : index ,
812
+ ModifyIndex : index ,
813
+ },
814
+ EnterpriseMeta : * structs .DefaultEnterpriseMetaInDefaultPartition (),
815
+ },
816
+ },
771
817
& structs.TxnResult {
772
818
Service : & structs.NodeService {
773
819
Service : "test-sidecar-proxy" ,
0 commit comments