@@ -1121,7 +1121,7 @@ func TestGetSubnetResourceID(t *testing.T) {
1121
1121
d .cloud .NetworkResourceSubscriptionID = ""
1122
1122
d .cloud .ResourceGroup = "foo"
1123
1123
d .cloud .VnetResourceGroup = "foo"
1124
- actualOutput := d .getSubnetResourceID ()
1124
+ actualOutput := d .getSubnetResourceID ("" , "" , "" )
1125
1125
expectedOutput := fmt .Sprintf (subnetTemplate , d .cloud .SubscriptionID , "foo" , d .cloud .VnetName , d .cloud .SubnetName )
1126
1126
assert .Equal (t , actualOutput , expectedOutput , "cloud.SubscriptionID should be used as the SubID" )
1127
1127
},
@@ -1135,7 +1135,7 @@ func TestGetSubnetResourceID(t *testing.T) {
1135
1135
d .cloud .NetworkResourceSubscriptionID = "fakeNetSubID"
1136
1136
d .cloud .ResourceGroup = "foo"
1137
1137
d .cloud .VnetResourceGroup = "foo"
1138
- actualOutput := d .getSubnetResourceID ()
1138
+ actualOutput := d .getSubnetResourceID ("" , "" , "" )
1139
1139
expectedOutput := fmt .Sprintf (subnetTemplate , d .cloud .NetworkResourceSubscriptionID , "foo" , d .cloud .VnetName , d .cloud .SubnetName )
1140
1140
assert .Equal (t , actualOutput , expectedOutput , "cloud.NetworkResourceSubscriptionID should be used as the SubID" )
1141
1141
},
@@ -1149,7 +1149,7 @@ func TestGetSubnetResourceID(t *testing.T) {
1149
1149
d .cloud .NetworkResourceSubscriptionID = "bar"
1150
1150
d .cloud .ResourceGroup = "fakeResourceGroup"
1151
1151
d .cloud .VnetResourceGroup = ""
1152
- actualOutput := d .getSubnetResourceID ()
1152
+ actualOutput := d .getSubnetResourceID ("" , "" , "" )
1153
1153
expectedOutput := fmt .Sprintf (subnetTemplate , "bar" , d .cloud .ResourceGroup , d .cloud .VnetName , d .cloud .SubnetName )
1154
1154
assert .Equal (t , actualOutput , expectedOutput , "cloud.Resourcegroup should be used as the rg" )
1155
1155
},
@@ -1163,11 +1163,25 @@ func TestGetSubnetResourceID(t *testing.T) {
1163
1163
d .cloud .NetworkResourceSubscriptionID = "bar"
1164
1164
d .cloud .ResourceGroup = "fakeResourceGroup"
1165
1165
d .cloud .VnetResourceGroup = "fakeVnetResourceGroup"
1166
- actualOutput := d .getSubnetResourceID ()
1166
+ actualOutput := d .getSubnetResourceID ("" , "" , "" )
1167
1167
expectedOutput := fmt .Sprintf (subnetTemplate , "bar" , d .cloud .VnetResourceGroup , d .cloud .VnetName , d .cloud .SubnetName )
1168
1168
assert .Equal (t , actualOutput , expectedOutput , "cloud.VnetResourceGroup should be used as the rg" )
1169
1169
},
1170
1170
},
1171
+ {
1172
+ name : "VnetResourceGroup, vnetName, subnetName is specified" ,
1173
+ testFunc : func (t * testing.T ) {
1174
+ d := NewFakeDriver ()
1175
+ d .cloud = & azure.Cloud {}
1176
+ d .cloud .SubscriptionID = "bar"
1177
+ d .cloud .NetworkResourceSubscriptionID = "bar"
1178
+ d .cloud .ResourceGroup = "fakeResourceGroup"
1179
+ d .cloud .VnetResourceGroup = "fakeVnetResourceGroup"
1180
+ actualOutput := d .getSubnetResourceID ("vnetrg" , "vnetName" , "subnetName" )
1181
+ expectedOutput := fmt .Sprintf (subnetTemplate , "bar" , "vnetrg" , "vnetName" , "subnetName" )
1182
+ assert .Equal (t , actualOutput , expectedOutput , "VnetResourceGroup, vnetName, subnetName is specified" )
1183
+ },
1184
+ },
1171
1185
}
1172
1186
for _ , tc := range testCases {
1173
1187
t .Run (tc .name , tc .testFunc )
0 commit comments