MCPcopy
hub / github.com/kubernetes/kubectl / TestGetObjectSubresourceStatus

Function TestGetObjectSubresourceStatus

pkg/cmd/get/get_test.go:184–210  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

182}
183
184func TestGetObjectSubresourceStatus(t *testing.T) {
185 _, _, replicationcontrollers := cmdtesting.TestData()
186
187 tf := cmdtesting.NewTestFactory().WithNamespace("test")
188 defer tf.Cleanup()
189 codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...)
190
191 tf.UnstructuredClient = &fake.RESTClient{
192 NegotiatedSerializer: resource.UnstructuredPlusDefaultContentConfig().NegotiatedSerializer,
193 Resp: &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.ObjBody(codec, &replicationcontrollers.Items[0])},
194 }
195
196 streams, _, buf, _ := genericiooptions.NewTestIOStreams()
197 cmd := NewCmdGet("kubectl", tf, streams)
198 cmd.SetOut(buf)
199 cmd.SetErr(buf)
200 cmd.Flags().Set("subresource", "status")
201 cmd.Run(cmd, []string{"replicationcontrollers", "rc1"})
202
203 expected := `NAME AGE
204rc1 <unknown>
205`
206
207 if e, a := expected, buf.String(); e != a {
208 t.Errorf("expected\n%v\ngot\n%v", e, a)
209 }
210}
211
212func TestGetObjectSubresourceScale(t *testing.T) {
213 _, _, replicationcontrollers := cmdtesting.TestData()

Callers

nothing calls this directly

Calls 5

NewCmdGetFunction · 0.85
WithNamespaceMethod · 0.80
CleanupMethod · 0.80
StringMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…