MCPcopy
hub / github.com/kubernetes/client-go / TestUpdateScale

Function TestUpdateScale

scale/client_test.go:253–279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestUpdateScale(t *testing.T) {
254 scaleClient, groupResources := fakeScaleClient(t)
255 expectedScale := &autoscalingv1.Scale{
256 TypeMeta: metav1.TypeMeta{
257 Kind: "Scale",
258 APIVersion: autoscalingv1.SchemeGroupVersion.String(),
259 },
260 ObjectMeta: metav1.ObjectMeta{
261 Name: "foo",
262 },
263 Spec: autoscalingv1.ScaleSpec{Replicas: 10},
264 Status: autoscalingv1.ScaleStatus{
265 Replicas: 10,
266 Selector: "foo=bar",
267 },
268 }
269
270 for _, groupResource := range groupResources {
271 scale, err := scaleClient.Scales("default").Update(groupResource, expectedScale)
272 if !assert.NoError(t, err, "should have been able to fetch a scale for %s", groupResource.String()) {
273 continue
274 }
275 assert.NotNil(t, scale, "should have returned a non-nil scale for %s", groupResource.String())
276
277 assert.Equal(t, expectedScale, scale, "should have returned the expected scale for %s", groupResource.String())
278 }
279}

Callers

nothing calls this directly

Calls 4

fakeScaleClientFunction · 0.85
StringMethod · 0.65
UpdateMethod · 0.65
ScalesMethod · 0.65

Tested by

no test coverage detected