1818 RegionPrice ,
1919)
2020
21+ # Lists of valid regions where NodeBalancers of type "premium" or "premium_40gb" can be created
22+ PREMIUM_REGIONS = [
23+ "nl-ams" ,
24+ "jp-tyo-3" ,
25+ "sg-sin-2" ,
26+ "de-fra-2" ,
27+ "in-bom-2" ,
28+ "gb-lon" ,
29+ "us-lax" ,
30+ "id-cgk" ,
31+ "us-mia" ,
32+ "it-mil" ,
33+ "jp-osa" ,
34+ "in-maa" ,
35+ "se-sto" ,
36+ "br-gru" ,
37+ "us-sea" ,
38+ "fr-par" ,
39+ "us-iad" ,
40+ ]
41+ PREMIUM_40GB_REGIONS = ["us-iad" ]
42+
2143TEST_REGION = get_region (
2244 LinodeClient (
2345 token = get_token (),
@@ -390,27 +412,22 @@ def test_nb_with_frontend_and_default_type(
390412 assert "NodeBalancer with frontend VPC IP must be premium" in error_msg
391413
392414
393- def test_nb_with_frontend_and_premium40gb_type (test_linode_client ):
394- region = "us-iad" # premium_40gb type can be used in specific regions only
415+ @pytest .mark .parametrize (
416+ "create_vpc_with_subnet_in_premium_region" ,
417+ [PREMIUM_40GB_REGIONS ],
418+ indirect = True ,
419+ )
420+ def test_nb_with_frontend_and_premium40gb_type (
421+ test_linode_client , create_vpc_with_subnet_in_premium_region
422+ ):
395423 client = test_linode_client
396424
397- vpc = client .vpcs .create (
398- label = get_test_label (length = 10 ),
399- region = region ,
400- description = "test description" ,
401- ipv6 = [{"range" : "auto" }],
402- )
403-
404- subnet = vpc .subnet_create (
405- label = "test-subnet" ,
406- ipv4 = "10.0.0.0/24" ,
407- ipv6 = [{"range" : "auto" }],
408- )
409-
410425 nb = client .nodebalancer_create (
411- region = region ,
426+ region = create_vpc_with_subnet_in_premium_region [ 0 ]. region ,
412427 label = get_test_label (length = 8 ),
413- frontend_vpcs = [{"subnet_id" : subnet .id }],
428+ frontend_vpcs = [
429+ {"subnet_id" : create_vpc_with_subnet_in_premium_region [1 ].id }
430+ ],
414431 type = "premium_40gb" ,
415432 )
416433 assert nb .type == "premium_40gb"
@@ -422,16 +439,18 @@ def test_nb_with_frontend_and_premium40gb_type(test_linode_client):
422439 assert nb_get .type == "premium_40gb"
423440
424441 nb .delete ()
425- vpc .delete ()
426442
427443
444+ @pytest .mark .parametrize (
445+ "create_vpc_with_subnet_in_premium_region" , [PREMIUM_REGIONS ], indirect = True
446+ )
428447def test_nb_with_frontend_and_backend_in_different_vpcs (
429- test_linode_client , create_vpc_with_subnet
448+ test_linode_client , create_vpc_with_subnet_in_premium_region
430449):
431450 client = test_linode_client
432- region = create_vpc_with_subnet [0 ].region
433- vpc_backend = create_vpc_with_subnet [0 ].id
434- subnet_backend = create_vpc_with_subnet [1 ].id
451+ region = create_vpc_with_subnet_in_premium_region [0 ].region
452+ vpc_backend = create_vpc_with_subnet_in_premium_region [0 ].id
453+ subnet_backend = create_vpc_with_subnet_in_premium_region [1 ].id
435454 label = get_test_label (8 )
436455 ipv4_range = "10.0.0.0/24"
437456 ipv4_address = "10.0.0.2" # first available address
0 commit comments