Updated the tests ()

Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
This commit is contained in:
Arjun
2020-02-04 09:48:50 +01:00
committed by GitHub
parent e3330dcf43
commit c9fa15c7d4

@ -100,26 +100,31 @@ func TestUpdateHPAsDisregardingIncompatibleHPA(t *testing.T) {
value := resource.MustParse("1k") value := resource.MustParse("1k")
hpa := &autoscalingv1.HorizontalPodAutoscaler{ hpa := &autoscaling.HorizontalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "hpa1", Name: "hpa1",
Namespace: "default", Namespace: "default",
Annotations: map[string]string{}, Annotations: map[string]string{},
}, },
Spec: autoscalingv1.HorizontalPodAutoscalerSpec{ Spec: autoscaling.HorizontalPodAutoscalerSpec{
ScaleTargetRef: autoscalingv1.CrossVersionObjectReference{ ScaleTargetRef: autoscaling.CrossVersionObjectReference{
Kind: "Deployment", Kind: "Deployment",
Name: "app", Name: "app",
APIVersion: "apps/v1", APIVersion: "apps/v1",
}, },
MinReplicas: &[]int32{1}[0], MinReplicas: &[]int32{1}[0],
MaxReplicas: 10, MaxReplicas: 10,
Metrics: []autoscalingv1.MetricSpec{ Metrics: []autoscaling.MetricSpec{
{ {
Type: autoscalingv1.ExternalMetricSourceType, Type: autoscaling.ExternalMetricSourceType,
External: &autoscalingv1.ExternalMetricSource{ External: &autoscaling.ExternalMetricSource{
MetricName: "some-other-metric", Metric: autoscaling.MetricIdentifier{
TargetAverageValue: &value, Name: "some-other-metric",
},
Target: autoscaling.MetricTarget{
Type: autoscaling.AverageValueMetricType,
AverageValue: &value,
},
}, },
}, },
}, },
@ -129,7 +134,7 @@ func TestUpdateHPAsDisregardingIncompatibleHPA(t *testing.T) {
fakeClient := fake.NewSimpleClientset() fakeClient := fake.NewSimpleClientset()
var err error var err error
_, err = fakeClient.AutoscalingV2beta1().HorizontalPodAutoscalers("default").Create(hpa) _, err = fakeClient.AutoscalingV2beta2().HorizontalPodAutoscalers("default").Create(hpa)
require.NoError(t, err) require.NoError(t, err)
collectorFactory := collector.NewCollectorFactory() collectorFactory := collector.NewCollectorFactory()