Skip to content

Commit

Permalink
test squash commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHinthorne committed Jun 18, 2024
1 parent 520c6ae commit fa15ea5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions cluster-autoscaler/expander/grpcplugin/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}
}
10 changes: 5 additions & 5 deletions cluster-autoscaler/expander/grpcplugin/grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
)

Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions cluster-autoscaler/expander/grpcplugin/protos/expander.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit fa15ea5

Please sign in to comment.