@@ -201,3 +201,49 @@ func TestNodeBalancer_Create_with_VPCs(t *testing.T) {
201201 assert .Equal (t , linodego .NodeBalancerVPCFrontendAddressTypeVPC , nb .FrontendAddressType )
202202 assert .Equal (t , 456 , * nb .FrontendVPCSubnetID )
203203}
204+
205+ func TestNodeBalancer_Create_with_BackendVPCs (t * testing.T ) {
206+ // The response fixture is the same as the VPCs test since BackendVPCs and
207+ // VPCs are currently both accepted by the API.
208+ fixtureData , err := fixtures .GetFixture ("nodebalancer_create_with_vpcs" )
209+ assert .NoError (t , err )
210+
211+ var base ClientBaseCase
212+ base .SetUp (t )
213+ defer base .TearDown (t )
214+
215+ requestData := linodego.NodeBalancerCreateOptions {
216+ Label : String ("Test NodeBalancer VPC" ),
217+ Region : "us-east" ,
218+ Type : linodego .NBTypePremium40GB ,
219+ BackendVPCs : []linodego.NodeBalancerVPCOptions {
220+ {
221+ SubnetID : 123 ,
222+ IPv4Range : "10.200.4.16/28" ,
223+ IPv6Range : "2600:3c01:e000:1::/64" ,
224+ IPv4RangeAutoAssign : false ,
225+ },
226+ },
227+ FrontendVPCs : []linodego.NodeBalancerFrontendVPCOptions {
228+ {
229+ SubnetID : 456 ,
230+ IPv4Range : "10.200.5.16/28" ,
231+ IPv6Range : "2600:3c01:e000:101::/64" ,
232+ },
233+ },
234+ }
235+
236+ base .MockPost ("nodebalancers" , fixtureData )
237+
238+ nb , err := base .Client .CreateNodeBalancer (context .Background (), requestData )
239+
240+ assert .NoError (t , err )
241+
242+ assert .Equal (t , 12345 , nb .ID )
243+ assert .Equal (t , "Test NodeBalancer VPC" , * nb .Label )
244+ assert .Equal (t , "us-east" , nb .Region )
245+ assert .Equal (t , linodego .NBTypePremium40GB , nb .Type )
246+
247+ assert .Equal (t , linodego .NodeBalancerVPCFrontendAddressTypeVPC , nb .FrontendAddressType )
248+ assert .Equal (t , 456 , * nb .FrontendVPCSubnetID )
249+ }
0 commit comments