以下示例是关于golang中包含api.PodList用法的示例代码,想了解api.PodList的具体用法?api.PodList怎么用?api.PodList使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。
40 Request: testRequest{Method: "GET", Path: "/pods"},
41 Response: Response{StatusCode: 200, Body: api.PodList{}},
42 }
50 Response: Response{StatusCode: 200,
51 Body: api.PodList{
52 Items: []api.Pod{
80 StatusCode: 200,
81 Body: api.PodList{
82 Items: []api.Pod{
213 }
214 pl := pods.(*api.PodList)
215 if len(pl.Items) != 1 {
238
239 if len(pods.(*api.PodList).Items) != 0 {
240 t.Errorf("Unexpected non-zero pod list: %#v", pods)
241 }
242 if pods.(*api.PodList).ResourceVersion != "1" {
243 t.Errorf("Unexpected resource version: %#v", pods)
273 podsObj, err := storage.List(api.NewDefaultContext(), labels.Everything(), labels.Everything())
274 pods := podsObj.(*api.PodList)
275 if err != nil {
367 }
368 pods := podsObj.(*api.PodList)
369
139 }
140 if pods.(*api.PodList) != nil {
141 t.Errorf("Unexpected non-nil pod list: %#v", pods)
145func TestListEmptyPodList(t *testing.T) {
146 podRegistry := registrytest.NewPodRegistry(&api.PodList{TypeMeta: api.TypeMeta{ResourceVersion: "1"}})
147 storage := REST{
155
156 if len(pods.(*api.PodList).Items) != 0 {
157 t.Errorf("Unexpected non-zero pod list: %#v", pods)
158 }
159 if pods.(*api.PodList).ResourceVersion != "1" {
160 t.Errorf("Unexpected resource version: %#v", pods)
173 podRegistry := registrytest.NewPodRegistry(nil)
174 podRegistry.Pods = &api.PodList{
175 Items: []api.Pod{
458 Fake: client.Fake{
459 PodsList: api.PodList{Items: []api.Pod{*newPod("pod0", "node0"), *newPod("pod1", "node1")}},
460 },
474 Fake: client.Fake{
475 PodsList: api.PodList{Items: []api.Pod{*newPod("pod0", "node1")}},
476 },
490 Fake: client.Fake{
491 PodsList: api.PodList{Items: []api.Pod{*newPod("pod0", "node0")}},
492 },
737 Fake: client.Fake{
738 PodsList: api.PodList{Items: []api.Pod{*newPod("pod0", "node1")}},
739 },
767 Fake: client.Fake{
768 PodsList: api.PodList{Items: []api.Pod{*newPod("pod0", "node0")}},
769 },
52 client := &client.Fake{
53 PodsList: api.PodList{
54 Items: []api.Pod{
87 client := &client.Fake{
88 PodsList: api.PodList{
89 Items: []api.Pod{
130 client := &client.Fake{
131 PodsList: api.PodList{
132 Items: []api.Pod{
165 client := &client.Fake{
166 PodsList: api.PodList{
167 Items: []api.Pod{
208 client := &client.Fake{
209 PodsList: api.PodList{
210 Items: []api.Pod{
100 }
101 expect := api.PodList{
102 ListMeta: api.ListMeta{ResourceVersion: "10"},
127
128 var got api.PodList
129 helper := EtcdHelper{fakeClient, testapi.Codec(), versioner}
182 }
183 expect := api.PodList{
184 ListMeta: api.ListMeta{ResourceVersion: "10"},
210
211 var got api.PodList
212 helper := EtcdHelper{fakeClient, testapi.Codec(), versioner}
253 }
254 expect := api.PodList{
255 ListMeta: api.ListMeta{ResourceVersion: "10"},
90 }
91 expect := api.PodList{
92 TypeMeta: api.TypeMeta{ResourceVersion: "10"},
99
100 var got api.PodList
101 helper := EtcdHelper{fakeClient, latest.Codec, versioner}
142 }
143 expect := api.PodList{
144 TypeMeta: api.TypeMeta{ResourceVersion: "10"},
150
151 var got api.PodList
152 helper := EtcdHelper{fakeClient, latest.Codec, versioner}
188 }
189 expect := api.PodList{
190 TypeMeta: api.TypeMeta{ResourceVersion: "10"},
110 }
111 if pods.(*api.PodList) != nil {
112 t.Errorf("Unexpected non-nil pod list: %#v", pods)
116func TestListEmptyPodList(t *testing.T) {
117 podRegistry := registrytest.NewPodRegistry(&api.PodList{JSONBase: api.JSONBase{ResourceVersion: 1}})
118 storage := RegistryStorage{
125
126 if len(pods.(*api.PodList).Items) != 0 {
127 t.Errorf("Unexpected non-zero pod list: %#v", pods)
128 }
129 if pods.(*api.PodList).ResourceVersion != 1 {
130 t.Errorf("Unexpected resource version: %#v", pods)
135 podRegistry := registrytest.NewPodRegistry(nil)
136 podRegistry.Pods = &api.PodList{
137 Items: []api.Pod{
89
90func (h *HumanReadablePrinter) printPodList(podList api.PodList, w io.Writer) error {
91 for _, pod := range podList.Items {
139 case "cluster#podList":
140 var list api.PodList
141 if err := json.Unmarshal([]byte(data), &list); err != nil {
193 return h.printPod(obj.(api.Pod), w)
194 case api.PodList:
195 h.printHeader(podColumns, w)
196 return h.printPodList(obj.(api.PodList), w)
197 case api.ReplicationController:
105
106func (h *HumanReadablePrinter) printPodList(podList api.PodList, w io.Writer) error {
107 for _, pod := range podList.Items {
155 case "cluster#podList":
156 var list api.PodList
157 if err := json.Unmarshal([]byte(data), &list); err != nil {
209 return h.printPod(obj.(api.Pod), w)
210 case api.PodList:
211 h.printHeader(podColumns, w)
212 return h.printPodList(obj.(api.PodList), w)
213 case api.ReplicationController:
本文地址:https://www.itbaoku.cn/snippets/415663.html