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

Function TestGetScale

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

Source from the content-addressed store, hash-verified

223}
224
225func TestGetScale(t *testing.T) {
226 scaleClient, groupResources := fakeScaleClient(t)
227 expectedScale := &autoscalingv1.Scale{
228 TypeMeta: metav1.TypeMeta{
229 Kind: "Scale",
230 APIVersion: autoscalingv1.SchemeGroupVersion.String(),
231 },
232 ObjectMeta: metav1.ObjectMeta{
233 Name: "foo",
234 },
235 Spec: autoscalingv1.ScaleSpec{Replicas: 10},
236 Status: autoscalingv1.ScaleStatus{
237 Replicas: 10,
238 Selector: "foo=bar",
239 },
240 }
241
242 for _, groupResource := range groupResources {
243 scale, err := scaleClient.Scales("default").Get(groupResource, "foo")
244 if !assert.NoError(t, err, "should have been able to fetch a scale for %s", groupResource.String()) {
245 continue
246 }
247 assert.NotNil(t, scale, "should have returned a non-nil scale for %s", groupResource.String())
248
249 assert.Equal(t, expectedScale, scale, "should have returned the expected scale for %s", groupResource.String())
250 }
251}
252
253func TestUpdateScale(t *testing.T) {
254 scaleClient, groupResources := fakeScaleClient(t)

Callers

nothing calls this directly

Calls 4

fakeScaleClientFunction · 0.85
StringMethod · 0.65
GetMethod · 0.65
ScalesMethod · 0.65

Tested by

no test coverage detected