@@ -74,22 +74,24 @@ func (f *FakeHTTPClient) Get(url string) (*http.Response, error) {
7474func TestMonitor_queryPodStatusz (t * testing.T ) {
7575 httpClient := & FakeHTTPClient {
7676 responses : map [string ]string {
77- "https://127.0.0.1 :8080/statusz" : "" ,
78- "https://127.0.0.3 :50100/statusz" : "CloudConnectFailed" ,
77+ "https://127-0-0-1.pl.pod.cluster.local :8080/statusz" : "" ,
78+ "https://127-0-0-3.pl2.pod.cluster.local :50100/statusz" : "CloudConnectFailed" ,
7979 },
8080 }
8181
8282 tests := []struct {
8383 name string
8484 podPort int32
8585 podIP string
86+ podNamespace string
8687 expectedStatus string
8788 expectedOK bool
8889 }{
8990 {
9091 name : "OK" ,
9192 podPort : 8080 ,
9293 podIP : "127.0.0.1" ,
94+ podNamespace : "pl" ,
9395 expectedStatus : "" ,
9496 expectedOK : true ,
9597 },
@@ -104,6 +106,7 @@ func TestMonitor_queryPodStatusz(t *testing.T) {
104106 name : "unhealthy" ,
105107 podPort : 50100 ,
106108 podIP : "127.0.0.3" ,
109+ podNamespace : "pl2" ,
107110 expectedStatus : "CloudConnectFailed" ,
108111 expectedOK : false ,
109112 },
@@ -115,6 +118,9 @@ func TestMonitor_queryPodStatusz(t *testing.T) {
115118 Status : v1.PodStatus {
116119 PodIP : test .podIP ,
117120 },
121+ ObjectMeta : metav1.ObjectMeta {
122+ Namespace : test .podNamespace ,
123+ },
118124 Spec : v1.PodSpec {
119125 Containers : []v1.Container {
120126 {
@@ -169,7 +175,7 @@ func TestMonitor_getCloudConnState(t *testing.T) {
169175 t .Run (test .name , func (t * testing.T ) {
170176 httpClient := & FakeHTTPClient {
171177 responses : map [string ]string {
172- "https://127.0.0.1 :8080/statusz" : test .cloudConnStatusz ,
178+ "https://127-0-0-1.pl.pod.cluster.local :8080/statusz" : test .cloudConnStatusz ,
173179 },
174180 }
175181
@@ -183,6 +189,9 @@ func TestMonitor_getCloudConnState(t *testing.T) {
183189 PodIP : "127.0.0.1" ,
184190 Phase : test .cloudConnPhase ,
185191 },
192+ ObjectMeta : metav1.ObjectMeta {
193+ Namespace : "pl" ,
194+ },
186195 Spec : v1.PodSpec {
187196 Containers : []v1.Container {
188197 {
@@ -500,9 +509,7 @@ func TestMonitor_repairVizier_PVC(t *testing.T) {
500509
501510func TestMonitor_getCloudConnState_SeveralCloudConns (t * testing.T ) {
502511 httpClient := & FakeHTTPClient {
503- responses : map [string ]string {
504- "https://127.0.0.1:8080/statusz" : "" ,
505- },
512+ responses : map [string ]string {},
506513 }
507514
508515 pods := & concurrentPodMap {unsafeMap : make (map [string ]map [string ]* podWrapper )}
@@ -545,8 +552,8 @@ func TestMonitor_getCloudConnState_SeveralCloudConns(t *testing.T) {
545552func TestMonitor_NATSPods (t * testing.T ) {
546553 httpClient := & FakeHTTPClient {
547554 responses : map [string ]string {
548- "http://127.0.0.1 :8222" : "" ,
549- "http://127.0.0.3 :8222" : "NATS Failed" ,
555+ "http://127-0-0-1.pl.pod.cluster.local :8222" : "" ,
556+ "http://127-0-0-3.pl.pod.cluster.local :8222" : "NATS Failed" ,
550557 },
551558 }
552559
@@ -624,6 +631,9 @@ func TestMonitor_NATSPods(t *testing.T) {
624631 PodIP : test .natsIP ,
625632 Phase : test .natsPhase ,
626633 },
634+ ObjectMeta : metav1.ObjectMeta {
635+ Namespace : "pl" ,
636+ },
627637 },
628638 },
629639 )
0 commit comments