From fa15ea5f5d0b606e607079b253ca094bcf46628e Mon Sep 17 00:00:00 2001 From: BenHinthorne Date: Tue, 18 Jun 2024 16:04:51 -0400 Subject: [PATCH] test squash commit --- .../expander/grpcplugin/grpc_client.go | 12 ++++++------ .../expander/grpcplugin/grpc_client_test.go | 10 +++++----- .../expander/grpcplugin/protos/expander.pb.go | 10 +++++----- .../expander/grpcplugin/protos/expander.proto | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cluster-autoscaler/expander/grpcplugin/grpc_client.go b/cluster-autoscaler/expander/grpcplugin/grpc_client.go index 679dce80e288..bccce82c844b 100644 --- a/cluster-autoscaler/expander/grpcplugin/grpc_client.go +++ b/cluster-autoscaler/expander/grpcplugin/grpc_client.go @@ -119,11 +119,11 @@ func populateOptionsForGRPC(expansionOptions []expander.Option) ([]*protos.Optio } func getSimilarNodeGroupIds(option expander.Option) []string { - var similarNodegroupIds []string + var similarNodeGroupIds []string for _, sng := range option.SimilarNodeGroups { - similarNodegroupIds = append(similarNodegroupIds, sng.Id()) + similarNodeGroupIds = append(similarNodeGroupIds, sng.Id()) } - return similarNodegroupIds + return similarNodeGroupIds } // populateNodeInfoForGRPC looks at the corresponding v1.Node object per NodeInfo object, and populates the grpcNodeInfoMap with these to pass over grpc @@ -160,7 +160,7 @@ func getRetainedSimilarNodegroups(grpcOption *protos.Option, expanderOption expa var retainedSimilarNodeGroups []cloudprovider.NodeGroup for _, sng := range expanderOption.SimilarNodeGroups { retained := false - for _, id := range grpcOption.SimilarNodegroupIds { + for _, id := range grpcOption.SimilarNodeGroupIds { if sng.Id() == id { retained = true continue @@ -173,6 +173,6 @@ func getRetainedSimilarNodegroups(grpcOption *protos.Option, expanderOption expa return retainedSimilarNodeGroups } -func newOptionMessage(nodeGroupId string, nodeCount int32, debug string, pods []*v1.Pod, similarNodegroupIds []string) *protos.Option { - return &protos.Option{NodeGroupId: nodeGroupId, NodeCount: nodeCount, Debug: debug, Pod: pods, SimilarNodegroupIds: similarNodegroupIds} +func newOptionMessage(nodeGroupId string, nodeCount int32, debug string, pods []*v1.Pod, similarNodeGroupIds []string) *protos.Option { + return &protos.Option{NodeGroupId: nodeGroupId, NodeCount: nodeCount, Debug: debug, Pod: pods, SimilarNodeGroupIds: similarNodeGroupIds} } diff --git a/cluster-autoscaler/expander/grpcplugin/grpc_client_test.go b/cluster-autoscaler/expander/grpcplugin/grpc_client_test.go index 113e1c8e2469..c97dced54e01 100644 --- a/cluster-autoscaler/expander/grpcplugin/grpc_client_test.go +++ b/cluster-autoscaler/expander/grpcplugin/grpc_client_test.go @@ -95,14 +95,14 @@ var ( NodeCount: int32(eoT2Micro.NodeCount), Debug: eoT2Micro.Debug, Pod: eoT2Micro.Pods, - SimilarNodegroupIds: []string{eoT2MicroWithSimilar.SimilarNodeGroups[0].Id()}, + SimilarNodeGroupIds: []string{eoT2MicroWithSimilar.SimilarNodeGroups[0].Id()}, } grpcEoT2MicroWithSimilarWithExtraOptions = protos.Option{ NodeGroupId: eoT2Micro.NodeGroup.Id(), NodeCount: int32(eoT2Micro.NodeCount), Debug: eoT2Micro.Debug, Pod: eoT2Micro.Pods, - SimilarNodegroupIds: []string{eoT2MicroWithSimilar.SimilarNodeGroups[0].Id(), "extra-ng-id"}, + SimilarNodeGroupIds: []string{eoT2MicroWithSimilar.SimilarNodeGroups[0].Id(), "extra-ng-id"}, } ) @@ -228,7 +228,7 @@ func TestBestOptionsValid(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockClient := mocks.NewMockExpanderClient(ctrl) - g := &grpcclientstrategy{grpcClient: mockClient} + g := &grpcclientstrategy{mockClient} nodeInfos := makeFakeNodeInfos() grpcNodeInfoMap := make(map[string]*v1.Node) @@ -254,7 +254,7 @@ func TestBestOptionsErrors(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockClient := mocks.NewMockExpanderClient(ctrl) - g := grpcclientstrategy{grpcClient: mockClient} + g := grpcclientstrategy{mockClient} badProtosOption := protos.Option{ NodeGroupId: "badID", @@ -272,7 +272,7 @@ func TestBestOptionsErrors(t *testing.T) { }{ { desc: "Bad gRPC client config", - client: grpcclientstrategy{grpcClient: nil}, + client: grpcclientstrategy{nil}, nodeInfo: makeFakeNodeInfos(), mockResponse: protos.BestOptionsResponse{}, errResponse: nil, diff --git a/cluster-autoscaler/expander/grpcplugin/protos/expander.pb.go b/cluster-autoscaler/expander/grpcplugin/protos/expander.pb.go index c194c16a3f47..6c6a022acc75 100644 --- a/cluster-autoscaler/expander/grpcplugin/protos/expander.pb.go +++ b/cluster-autoscaler/expander/grpcplugin/protos/expander.pb.go @@ -145,7 +145,7 @@ type Option struct { NodeCount int32 `protobuf:"varint,2,opt,name=nodeCount,proto3" json:"nodeCount,omitempty"` Debug string `protobuf:"bytes,3,opt,name=debug,proto3" json:"debug,omitempty"` Pod []*v1.Pod `protobuf:"bytes,4,rep,name=pod,proto3" json:"pod,omitempty"` - SimilarNodegroupIds []string `protobuf:"bytes,5,rep,name=similarNodegroupIds,proto3" json:"similarNodegroupIds,omitempty"` + SimilarNodeGroupIds []string `protobuf:"bytes,5,rep,name=similarNodeGroupIds,proto3" json:"similarNodeGroupIds,omitempty"` } func (x *Option) Reset() { @@ -208,9 +208,9 @@ func (x *Option) GetPod() []*v1.Pod { return nil } -func (x *Option) GetSimilarNodegroupIds() []string { +func (x *Option) GetSimilarNodeGroupIds() []string { if x != nil { - return x.SimilarNodegroupIds + return x.SimilarNodeGroupIds } return nil } @@ -250,8 +250,8 @@ var file_expander_proto_rawDesc = []byte{ 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6b, 0x38, 0x73, 0x2e, 0x69, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x64, 0x52, 0x03, 0x70, 0x6f, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x4e, 0x6f, - 0x64, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x13, 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x67, 0x72, 0x6f, + 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x13, 0x73, 0x69, 0x6d, 0x69, 0x6c, 0x61, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x73, 0x32, 0x5c, 0x0a, 0x08, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x50, 0x0a, 0x0b, 0x42, 0x65, 0x73, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x42, 0x65, diff --git a/cluster-autoscaler/expander/grpcplugin/protos/expander.proto b/cluster-autoscaler/expander/grpcplugin/protos/expander.proto index ef696516f986..8300ed49695e 100644 --- a/cluster-autoscaler/expander/grpcplugin/protos/expander.proto +++ b/cluster-autoscaler/expander/grpcplugin/protos/expander.proto @@ -27,5 +27,5 @@ message Option { int32 nodeCount = 2; string debug = 3; repeated k8s.io.api.core.v1.Pod pod = 4; - repeated string similarNodegroupIds = 5; + repeated string similarNodeGroupIds = 5; }