@@ -168,7 +168,7 @@ func TestInitFederation(t *testing.T) {
168
168
want = fmt .Sprintf ("Federation control plane runs (dry run)\n " )
169
169
}
170
170
171
- if got := buf .String (); got != want {
171
+ if got := buf .String (); ! strings . Contains ( got , want ) {
172
172
t .Errorf ("[%d] unexpected output: got: %s, want: %s" , i , got , want )
173
173
if cmdErrMsg != "" {
174
174
t .Errorf ("[%d] unexpected error message: %s" , i , cmdErrMsg )
@@ -693,6 +693,38 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
693
693
},
694
694
}
695
695
696
+ podList := v1.PodList {}
697
+ apiServerPod := v1.Pod {
698
+ TypeMeta : metav1.TypeMeta {
699
+ Kind : "Pod" ,
700
+ APIVersion : testapi .Extensions .GroupVersion ().String (),
701
+ },
702
+ ObjectMeta : v1.ObjectMeta {
703
+ Name : svcName ,
704
+ Namespace : namespaceName ,
705
+ },
706
+ Status : v1.PodStatus {
707
+ Phase : "Running" ,
708
+ },
709
+ }
710
+
711
+ ctrlMgrPod := v1.Pod {
712
+ TypeMeta : metav1.TypeMeta {
713
+ Kind : "Pod" ,
714
+ APIVersion : testapi .Extensions .GroupVersion ().String (),
715
+ },
716
+ ObjectMeta : v1.ObjectMeta {
717
+ Name : cmName ,
718
+ Namespace : namespaceName ,
719
+ },
720
+ Status : v1.PodStatus {
721
+ Phase : "Running" ,
722
+ },
723
+ }
724
+
725
+ podList .Items = append (podList .Items , apiServerPod )
726
+ podList .Items = append (podList .Items , ctrlMgrPod )
727
+
696
728
f , tf , codec , _ := cmdtesting .NewAPIFactory ()
697
729
extCodec := testapi .Extensions .Codec ()
698
730
ns := dynamic .ContentConfig ().NegotiatedSerializer
@@ -794,7 +826,11 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
794
826
return nil , fmt .Errorf ("Unexpected deployment object\n \t Diff: %s" , diff .ObjectGoPrintDiff (got , want ))
795
827
}
796
828
return & http.Response {StatusCode : http .StatusCreated , Header : kubefedtesting .DefaultHeader (), Body : kubefedtesting .ObjBody (extCodec , & want )}, nil
829
+ case p == "/api/v1/namespaces/federation-system/pods" && m == http .MethodGet :
830
+ return & http.Response {StatusCode : http .StatusOK , Header : kubefedtesting .DefaultHeader (), Body : kubefedtesting .ObjBody (codec , & podList )}, nil
831
+
797
832
default :
833
+ fmt .Println ("Unknon api called %v\n " , p )
798
834
return nil , fmt .Errorf ("unexpected request: %#v\n %#v" , req .URL , req )
799
835
}
800
836
}),
0 commit comments