Skip to content

Commit

Permalink
hpa fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pepov committed Jun 6, 2024
1 parent a3fff6b commit 39671a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"emperror.dev/errors"
admregv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/autoscaling/v2beta1"
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -657,10 +657,10 @@ func TestIntegration(t *testing.T) {
pod.Spec.Replicas = &replicas
}),
NewTestMatch("hpa match",
&v2beta1.HorizontalPodAutoscaler{
&autoscalingv1.HorizontalPodAutoscaler{
ObjectMeta: standardObjectMeta(),
Spec: v2beta1.HorizontalPodAutoscalerSpec{
ScaleTargetRef: v2beta1.CrossVersionObjectReference{
Spec: autoscalingv1.HorizontalPodAutoscalerSpec{
ScaleTargetRef: autoscalingv1.CrossVersionObjectReference{
Kind: "Deployment",
Name: "test",
APIVersion: "apps/v1",
Expand Down
8 changes: 4 additions & 4 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"emperror.dev/errors"
admregv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/autoscaling/v2beta1"
autoscalingv1 "k8s.io/api/autoscaling/v1"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -330,13 +330,13 @@ func testMatchOnObject(testItem *TestItem, ignoreField string) error {
log.Printf("Failed to remove object %s %+v", existing.GetName(), err)
}
}()
case *v2beta1.HorizontalPodAutoscaler:
existing, err = testContext.Client.AutoscalingV2beta1().HorizontalPodAutoscalers(newObject.GetNamespace()).Create(context.Background(), newObject.(*v2beta1.HorizontalPodAutoscaler), metav1.CreateOptions{})
case *autoscalingv1.HorizontalPodAutoscaler:
existing, err = testContext.Client.AutoscalingV1().HorizontalPodAutoscalers(newObject.GetNamespace()).Create(context.Background(), newObject.(*autoscalingv1.HorizontalPodAutoscaler), metav1.CreateOptions{})
if err != nil {
return errors.WrapWithDetails(err, "failed to create object", "object", newObject)
}
defer func() {
err = testContext.Client.AutoscalingV2beta1().HorizontalPodAutoscalers(newObject.GetNamespace()).Delete(context.Background(), existing.GetName(), deleteOptions)
err = testContext.Client.AutoscalingV1().HorizontalPodAutoscalers(newObject.GetNamespace()).Delete(context.Background(), existing.GetName(), deleteOptions)
if err != nil {
log.Printf("Failed to remove object %s %+v", existing.GetName(), err)
}
Expand Down

0 comments on commit 39671a6

Please sign in to comment.