|
13 | 13 | ) |
14 | 14 |
|
15 | 15 |
|
| 16 | +# Lists of valid regions where NodeBalancers of type "premium" or "premium_40gb" can be created |
| 17 | +PREMIUM_REGIONS = [ |
| 18 | + "nl-ams", |
| 19 | + "jp-tyo-3", |
| 20 | + "sg-sin-2", |
| 21 | + "de-fra-2", |
| 22 | + "in-bom-2", |
| 23 | + "gb-lon", |
| 24 | + "us-lax", |
| 25 | + "id-cgk", |
| 26 | + "us-mia", |
| 27 | + "it-mil", |
| 28 | + "jp-osa", |
| 29 | + "in-maa", |
| 30 | + "se-sto", |
| 31 | + "br-gru", |
| 32 | + "us-sea", |
| 33 | + "fr-par", |
| 34 | + "us-iad", |
| 35 | + "pl-labkrk-2", # DevCloud |
| 36 | +] |
| 37 | +PREMIUM_40GB_REGIONS = ["us-iad"] # No DevCloud region for premium_40gb type |
| 38 | + |
| 39 | + |
16 | 40 | def nodebalancer_created(): |
17 | 41 | return "[0-9]+,balancer[0-9]+,us-ord,[0-9]+-[0-9]+-[0-9]+-[0-9]+.ip.linodeusercontent.com,0" |
18 | 42 |
|
@@ -595,6 +619,7 @@ def test_nb_with_backend_vpc_only(get_vpc_with_subnet): |
595 | 619 | delete_target_id(target="nodebalancers", id=nb_id) |
596 | 620 |
|
597 | 621 |
|
| 622 | +@pytest.mark.parametrize("get_vpc_with_subnet", [PREMIUM_REGIONS], indirect=True) |
598 | 623 | def test_nb_with_frontend_ipv4_only(get_vpc_with_subnet): |
599 | 624 | vpc = get_vpc_with_subnet |
600 | 625 | ipv4_address = "10.0.0.2" # first available address |
@@ -637,3 +662,68 @@ def test_nb_with_frontend_ipv4_only(get_vpc_with_subnet): |
637 | 662 | # assert len(nb_backend_vpcs) == 0 |
638 | 663 |
|
639 | 664 | delete_target_id(target="nodebalancers", id=nb_id) |
| 665 | + |
| 666 | + |
| 667 | +@pytest.mark.parametrize("get_vpc_with_subnet", [PREMIUM_REGIONS], indirect=True) |
| 668 | +def test_nb_with_frontend_ipv6_in_single_stack_vpc_fail(get_vpc_with_subnet): |
| 669 | + vpc = get_vpc_with_subnet |
| 670 | + |
| 671 | + result = exec_failing_test_command( |
| 672 | + BASE_CMDS["nodebalancers"] |
| 673 | + + [ |
| 674 | + "create", |
| 675 | + "--region", |
| 676 | + vpc["region"], |
| 677 | + "--frontend_vpcs.subnet_id", |
| 678 | + str(vpc["subnets"][0]["id"]), |
| 679 | + "--frontend_vpcs.ipv6_range", |
| 680 | + "/62", |
| 681 | + "--type", |
| 682 | + "premium", |
| 683 | + ], |
| 684 | + ) |
| 685 | + assert "Request failed: 400" in result |
| 686 | + assert "No IPv6 subnets available in VPC" in result |
| 687 | + |
| 688 | + |
| 689 | +@pytest.mark.parametrize("get_vpc_with_subnet", [PREMIUM_REGIONS], indirect=True) |
| 690 | +def test_nb_with_frontend_and_default_type_fail(get_vpc_with_subnet): |
| 691 | + vpc = get_vpc_with_subnet |
| 692 | + |
| 693 | + result = exec_failing_test_command( |
| 694 | + BASE_CMDS["nodebalancers"] |
| 695 | + + [ |
| 696 | + "create", |
| 697 | + "--region", |
| 698 | + vpc["region"], |
| 699 | + "--frontend_vpcs.subnet_id", |
| 700 | + str(vpc["subnets"][0]["id"]), |
| 701 | + ], |
| 702 | + ) |
| 703 | + assert "Request failed: 400" in result |
| 704 | + assert "NodeBalancer with frontend VPC IP must be premium" in result |
| 705 | + |
| 706 | + |
| 707 | +@pytest.mark.parametrize( |
| 708 | + "get_vpc_with_subnet", |
| 709 | + [PREMIUM_40GB_REGIONS], |
| 710 | + indirect=True, |
| 711 | +) |
| 712 | +def test_nb_with_premium40gb_type(get_vpc_with_subnet): |
| 713 | + vpc = get_vpc_with_subnet |
| 714 | + |
| 715 | + nb_attrs = exec_test_command( |
| 716 | + BASE_CMDS["nodebalancers"] |
| 717 | + + [ |
| 718 | + "create", |
| 719 | + "--region", |
| 720 | + vpc["region"], |
| 721 | + "--type", |
| 722 | + "premium_40gb", |
| 723 | + "--json", |
| 724 | + ], |
| 725 | + ) |
| 726 | + nb_attrs = json.loads(nb_attrs) |
| 727 | + assert nb_attrs[0]["type"] == "premium_40gb" |
| 728 | + |
| 729 | + delete_target_id(target="nodebalancers", id=str(nb_attrs[0]["id"])) |
0 commit comments