@@ -800,27 +800,27 @@ func TestConvertMiStringToInt64(t *testing.T) {
800
800
}
801
801
}
802
802
803
- func TestParseMachineFamily (t * testing.T ) {
803
+ func TestParseMachineType (t * testing.T ) {
804
804
tests := []struct {
805
- desc string
806
- inputMachineTypeUrl string
807
- expectedMachineFamily string
808
- expectError bool
805
+ desc string
806
+ inputMachineTypeUrl string
807
+ expectedMachineType string
808
+ expectError bool
809
809
}{
810
810
{
811
- desc : "full URL machine family " ,
812
- inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
813
- expectedMachineFamily : "c3" ,
811
+ desc : "full URL machine type " ,
812
+ inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
813
+ expectedMachineType : "c3-highcpu-4 " ,
814
814
},
815
815
{
816
- desc : "partial URL machine family " ,
817
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
818
- expectedMachineFamily : "n2" ,
816
+ desc : "partial URL machine type " ,
817
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
818
+ expectedMachineType : "n2-standard-4 " ,
819
819
},
820
820
{
821
- desc : "custom partial URL machine family " ,
822
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
823
- expectedMachineFamily : "e2" ,
821
+ desc : "custom partial URL machine type " ,
822
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
823
+ expectedMachineType : "e2-custom-2-4096 " ,
824
824
},
825
825
{
826
826
desc : "incorrect URL" ,
@@ -840,15 +840,15 @@ func TestParseMachineFamily(t *testing.T) {
840
840
}
841
841
for _ , tc := range tests {
842
842
t .Run (tc .desc , func (t * testing.T ) {
843
- actualMachineFamily , err := ParseMachineFamily (tc .inputMachineTypeUrl )
843
+ actualMachineFamily , err := ParseMachineType (tc .inputMachineTypeUrl )
844
844
if err != nil && ! tc .expectError {
845
- t .Errorf ("Got error %v parsing machine family %s; expect no error" , err , tc .inputMachineTypeUrl )
845
+ t .Errorf ("Got error %v parsing machine type %s; expect no error" , err , tc .inputMachineTypeUrl )
846
846
}
847
847
if err == nil && tc .expectError {
848
- t .Errorf ("Got no error parsing machine family %s; expect an error" , tc .inputMachineTypeUrl )
848
+ t .Errorf ("Got no error parsing machine type %s; expect an error" , tc .inputMachineTypeUrl )
849
849
}
850
- if err == nil && actualMachineFamily != tc .expectedMachineFamily {
851
- t .Errorf ("Got %s parsing machine family ; expect %s" , actualMachineFamily , tc .expectedMachineFamily )
850
+ if err == nil && actualMachineFamily != tc .expectedMachineType {
851
+ t .Errorf ("Got %s parsing machine type ; expect %s" , actualMachineFamily , tc .expectedMachineType )
852
852
}
853
853
})
854
854
}
0 commit comments