@@ -578,27 +578,27 @@ func TestSnapshotStorageLocations(t *testing.T) {
578
578
}
579
579
}
580
580
581
- func TestParseMachineFamily (t * testing.T ) {
581
+ func TestParseMachineType (t * testing.T ) {
582
582
tests := []struct {
583
- desc string
584
- inputMachineTypeUrl string
585
- expectedMachineFamily string
586
- expectError bool
583
+ desc string
584
+ inputMachineTypeUrl string
585
+ expectedMachineType string
586
+ expectError bool
587
587
}{
588
588
{
589
- desc : "full URL machine family " ,
590
- inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
591
- expectedMachineFamily : "c3" ,
589
+ desc : "full URL machine type " ,
590
+ inputMachineTypeUrl : "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/machineTypes/c3-highcpu-4" ,
591
+ expectedMachineType : "c3-highcpu-4 " ,
592
592
},
593
593
{
594
- desc : "partial URL machine family " ,
595
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
596
- expectedMachineFamily : "n2" ,
594
+ desc : "partial URL machine type " ,
595
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/n2-standard-4" ,
596
+ expectedMachineType : "n2-standard-4 " ,
597
597
},
598
598
{
599
- desc : "custom partial URL machine family " ,
600
- inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
601
- expectedMachineFamily : "e2" ,
599
+ desc : "custom partial URL machine type " ,
600
+ inputMachineTypeUrl : "zones/us-central1-c/machineTypes/e2-custom-2-4096" ,
601
+ expectedMachineType : "e2-custom-2-4096 " ,
602
602
},
603
603
{
604
604
desc : "incorrect URL" ,
@@ -618,15 +618,15 @@ func TestParseMachineFamily(t *testing.T) {
618
618
}
619
619
for _ , tc := range tests {
620
620
t .Run (tc .desc , func (t * testing.T ) {
621
- actualMachineFamily , err := ParseMachineFamily (tc .inputMachineTypeUrl )
621
+ actualMachineFamily , err := ParseMachineType (tc .inputMachineTypeUrl )
622
622
if err != nil && ! tc .expectError {
623
- t .Errorf ("Got error %v parsing machine family %s; expect no error" , err , tc .inputMachineTypeUrl )
623
+ t .Errorf ("Got error %v parsing machine type %s; expect no error" , err , tc .inputMachineTypeUrl )
624
624
}
625
625
if err == nil && tc .expectError {
626
- t .Errorf ("Got no error parsing machine family %s; expect an error" , tc .inputMachineTypeUrl )
626
+ t .Errorf ("Got no error parsing machine type %s; expect an error" , tc .inputMachineTypeUrl )
627
627
}
628
- if err == nil && actualMachineFamily != tc .expectedMachineFamily {
629
- t .Errorf ("Got %s parsing machine family ; expect %s" , actualMachineFamily , tc .expectedMachineFamily )
628
+ if err == nil && actualMachineFamily != tc .expectedMachineType {
629
+ t .Errorf ("Got %s parsing machine type ; expect %s" , actualMachineFamily , tc .expectedMachineType )
630
630
}
631
631
})
632
632
}
0 commit comments