Skip to content

Commit e323c01

Browse files
Challa ReddyHarness
authored andcommitted
fix: [CCM-32115]: Corrected the warning which are caused by the c4a,x4 instance types because they have 4 instanceTypeParts (#48)
* a2f9be fix: [CCM-32115]: Corrected the warning which are caused by the c4a instance types because they have 4 instanceTypeParts
1 parent 30a4074 commit e323c01

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

internal/cloudinfo/providers/google/instancefamily_mapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
func (g *GceInfoer) mapSeries(instanceType string) string {
2626
instanceTypeParts := strings.Split(instanceType, "-")
2727

28-
if len(instanceTypeParts) == 2 || len(instanceTypeParts) == 3 {
28+
if len(instanceTypeParts) >= 2 && len(instanceTypeParts) <= 4 {
2929
return instanceTypeParts[0]
3030
}
3131

internal/cloudinfo/providers/google/instancefamily_mapper_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ import (
2525

2626
func TestGoogleInfoer_mapSeries(t *testing.T) {
2727
familySeriesMap := map[string]string{
28-
"n2-highmem-2": "n2",
29-
"e2-micro": "e2",
30-
"n2d-standard-8": "n2d",
31-
"unidentifiedType": "unidentifiedType",
28+
"n2-highmem-2": "n2",
29+
"e2-micro": "e2",
30+
"n2d-standard-8": "n2d",
31+
"c4a-highmem-8-lssd": "c4a",
32+
"unidentifiedType": "unidentifiedType",
3233
}
3334

3435
gceInfoer := GceInfoer{log: cloudinfoadapter.NewLogger(&logur.TestLogger{})}

0 commit comments

Comments
 (0)