@@ -788,27 +788,27 @@ func TestConvertMiBStringToInt64(t *testing.T) {
788
788
}
789
789
}
790
790
791
- func TestParseMachineFamily (t * testing.T ) {
791
+ func TestParseMachineType (t * testing.T ) {
792
792
tests := []struct {
793
- desc string
794
- inputMachineTypeUrl string
795
- expectedMachineFamily string
796
- expectError bool
793
+ desc string
794
+ inputMachineTypeUrl string
795
+ expectedMachineType string
796
+ expectError bool
797
797
}{
798
798
{
799
- desc : "full URL machine family " ,
800
- inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
801
- expectedMachineFamily : "c3" ,
799
+ desc : "full URL machine type " ,
800
+ inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
801
+ expectedMachineType : "c3-highcpu-4 " ,
802
802
},
803
803
{
804
- desc : "partial URL machine family " ,
805
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
806
- expectedMachineFamily : "n2" ,
804
+ desc : "partial URL machine type " ,
805
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
806
+ expectedMachineType : "n2-standard-4 " ,
807
807
},
808
808
{
809
- desc : "custom partial URL machine family " ,
810
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
811
- expectedMachineFamily : "e2" ,
809
+ desc : "custom partial URL machine type " ,
810
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
811
+ expectedMachineType : "e2-custom-2-4096 " ,
812
812
},
813
813
{
814
814
desc : "incorrect URL" ,
@@ -828,15 +828,15 @@ func TestParseMachineFamily(t *testing.T) {
828
828
}
829
829
for _ , tc := range tests {
830
830
t .Run (tc .desc , func (t * testing.T ) {
831
- actualMachineFamily , err := ParseMachineFamily (tc .inputMachineTypeUrl )
831
+ actualMachineFamily , err := ParseMachineType (tc .inputMachineTypeUrl )
832
832
if err != nil && ! tc .expectError {
833
- t .Errorf ("Got error %v parsing machine family %s; expect no error" , err , tc .inputMachineTypeUrl )
833
+ t .Errorf ("Got error %v parsing machine type %s; expect no error" , err , tc .inputMachineTypeUrl )
834
834
}
835
835
if err == nil && tc .expectError {
836
- t .Errorf ("Got no error parsing machine family %s; expect an error" , tc .inputMachineTypeUrl )
836
+ t .Errorf ("Got no error parsing machine type %s; expect an error" , tc .inputMachineTypeUrl )
837
837
}
838
- if err == nil && actualMachineFamily != tc .expectedMachineFamily {
839
- t .Errorf ("Got %s parsing machine family ; expect %s" , actualMachineFamily , tc .expectedMachineFamily )
838
+ if err == nil && actualMachineFamily != tc .expectedMachineType {
839
+ t .Errorf ("Got %s parsing machine type ; expect %s" , actualMachineFamily , tc .expectedMachineType )
840
840
}
841
841
})
842
842
}
0 commit comments