@@ -355,14 +355,17 @@ def test_nb_with_frontend_ipv6_only_in_single_stack_vpc(
355355 subnet = create_vpc_with_subnet_ipv4 [1 ].id
356356 label = get_test_label (8 )
357357
358- with pytest .raises (ApiError ) as err :
358+ with pytest .raises (ApiError ) as excinfo :
359359 client .nodebalancer_create (
360360 region = vpc_region ,
361361 label = label ,
362362 frontend_vpcs = [{"subnet_id" : subnet , "ipv6_range" : "/62" }],
363363 type = "premium" ,
364364 )
365- assert "No IPv6 subnets available in VPC" in str (err .json )
365+
366+ error_msg = str (excinfo .value .json )
367+ assert excinfo .value .status == 400
368+ assert "No IPv6 subnets available in VPC" in error_msg
366369
367370
368371def test_nb_with_frontend_and_default_type (
@@ -373,15 +376,16 @@ def test_nb_with_frontend_and_default_type(
373376 subnet = create_vpc_with_subnet [1 ].id
374377 label = get_test_label (8 )
375378
376- with pytest .raises (ApiError ) as err :
379+ with pytest .raises (ApiError ) as excinfo :
377380 client .nodebalancer_create (
378381 region = vpc_region ,
379382 label = label ,
380383 frontend_vpcs = [{"subnet_id" : subnet }],
381384 )
382- assert "Nodebalancer with frontend VPC IP must be premium" in str (
383- err .json
384- )
385+
386+ error_msg = str (excinfo .value .json )
387+ assert excinfo .value .status == 400
388+ assert "NodeBalancer with frontend VPC IP must be premium" in error_msg
385389
386390
387391def test_nb_with_frontend_and_premium40gb_type (test_linode_client ):
@@ -466,12 +470,13 @@ def test_nb_with_frontend_and_backend_in_different_vpcs(
466470
467471 nb_get = NodeBalancer (client , nb .id )
468472 nb_vpcs = nb_get .vpcs ()
473+ nb_vpcs .sort (key = lambda x : x .purpose )
469474
470475 assert len (nb_vpcs ) == 2
471- assert nb_vpcs [0 ].ipv4_range == f" { ipv4_address } /32 "
472- assert nb_vpcs [0 ]. ipv6_range == f"{ ipv6_address [: - 1 ] } /64 "
473- assert nb_vpcs [0 ]. purpose == "frontend "
474- assert nb_vpcs [1 ].purpose == "backend "
476+ assert nb_vpcs [0 ].purpose == "backend "
477+ assert nb_vpcs [1 ]. ipv4_range == f"{ ipv4_address } /32 "
478+ assert nb_vpcs [1 ]. ipv6_range == f" { ipv6_address [: - 1 ] } /64 "
479+ assert nb_vpcs [1 ].purpose == "frontend "
475480
476481 # TODO: Uncomment when API implementation of /backend_vpcs and /frontend_vpcs endpoints is finished
477482 # nb_backend_vpcs = nb_get.backend_vpcs()
0 commit comments