mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2025-03-10 12:28:03 +00:00
Updated the tests (#103)
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
This commit is contained in:
@ -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()
|
||||||
|
Reference in New Issue
Block a user