Skip to content

Commit

Permalink
cleanup unused constants in clusterapi provider
Browse files Browse the repository at this point in the history
this change removes some unused values and adjusts the names in the unit
tests to better reflect usage.
  • Loading branch information
elmiko committed Sep 29, 2022
1 parent ca6ed15 commit 5c9cc27
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -581,32 +581,32 @@ func deleteTestConfigs(t *testing.T, controller *machineController, testConfigs

func TestControllerFindMachine(t *testing.T) {
type testCase struct {
description string
name string
namespace string
useDeprecatedAnnotation bool
lookupSucceeds bool
description string
name string
namespace string
useAnnotation bool
lookupSucceeds bool
}

var testCases = []testCase{{
description: "lookup fails",
lookupSucceeds: false,
useDeprecatedAnnotation: false,
name: "machine-does-not-exist",
namespace: "namespace-does-not-exist",
description: "lookup fails",
lookupSucceeds: false,
useAnnotation: false,
name: "machine-does-not-exist",
namespace: "namespace-does-not-exist",
}, {
description: "lookup fails in valid namespace",
lookupSucceeds: false,
useDeprecatedAnnotation: false,
name: "machine-does-not-exist-in-existing-namespace",
description: "lookup fails in valid namespace",
lookupSucceeds: false,
useAnnotation: false,
name: "machine-does-not-exist-in-existing-namespace",
}, {
description: "lookup succeeds",
lookupSucceeds: true,
useDeprecatedAnnotation: false,
description: "lookup succeeds",
lookupSucceeds: true,
useAnnotation: false,
}, {
description: "lookup succeeds with deprecated annotation",
lookupSucceeds: true,
useDeprecatedAnnotation: true,
description: "lookup succeeds with annotation",
lookupSucceeds: true,
useAnnotation: true,
}}

test := func(t *testing.T, tc testCase, testConfig *testConfig) {
Expand Down Expand Up @@ -644,7 +644,7 @@ func TestControllerFindMachine(t *testing.T) {
if tc.namespace == "" {
tc.namespace = testConfig.machines[0].GetNamespace()
}
if tc.useDeprecatedAnnotation {
if tc.useAnnotation {
for i := range testConfig.machines {
n := testConfig.nodes[i]
annotations := n.GetAnnotations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import (
)

const (
deprecatedNodeGroupMinSizeAnnotationKey = "cluster.k8s.io/cluster-api-autoscaler-node-group-min-size"
deprecatedNodeGroupMaxSizeAnnotationKey = "cluster.k8s.io/cluster-api-autoscaler-node-group-max-size"
deprecatedClusterNameLabel = "cluster.k8s.io/cluster-name"

cpuKey = "capacity.cluster-autoscaler.kubernetes.io/cpu"
memoryKey = "capacity.cluster-autoscaler.kubernetes.io/memory"
gpuTypeKey = "capacity.cluster-autoscaler.kubernetes.io/gpu-type"
Expand Down

0 comments on commit 5c9cc27

Please sign in to comment.