99
1010import pytest
1111
12- from linode_api4 import LinodeInterface
12+ from linode_api4 import InterfaceGeneration , LinodeInterface
1313from linode_api4 .errors import ApiError
1414from linode_api4 .objects import (
1515 Config ,
@@ -67,7 +67,7 @@ def linode_with_volume_firewall(test_linode_client):
6767 linode_instance .delete ()
6868
6969
70- @pytest .fixture (scope = "session " )
70+ @pytest .fixture (scope = "function " )
7171def linode_for_network_interface_tests (test_linode_client , e2e_test_firewall ):
7272 client = test_linode_client
7373 region = get_region (client , {"Linodes" , "Cloud Firewall" }, site_type = "core" )
@@ -79,13 +79,37 @@ def linode_for_network_interface_tests(test_linode_client, e2e_test_firewall):
7979 image = "linode/debian12" ,
8080 label = label ,
8181 firewall = e2e_test_firewall ,
82+ interface_generation = InterfaceGeneration .LEGACY_CONFIG ,
8283 )
8384
8485 yield linode_instance
8586
8687 linode_instance .delete ()
8788
8889
90+ @pytest .fixture (scope = "function" )
91+ def linode_and_vpc_for_network_interface_tests_offline (
92+ test_linode_client , create_vpc_with_subnet , e2e_test_firewall
93+ ):
94+ vpc , subnet = create_vpc_with_subnet
95+
96+ label = get_test_label (length = 8 )
97+
98+ instance , password = test_linode_client .linode .instance_create (
99+ "g6-standard-1" ,
100+ vpc .region ,
101+ booted = False ,
102+ image = "linode/debian11" ,
103+ label = label ,
104+ firewall = e2e_test_firewall ,
105+ interface_generation = InterfaceGeneration .LEGACY_CONFIG ,
106+ )
107+
108+ yield vpc , subnet , instance , password
109+
110+ instance .delete ()
111+
112+
89113@pytest .fixture (scope = "session" )
90114def linode_for_vpu_tests (test_linode_client , e2e_test_firewall ):
91115 client = test_linode_client
@@ -181,7 +205,7 @@ def create_linode_for_long_running_tests(test_linode_client, e2e_test_firewall):
181205def linode_with_disk_encryption (test_linode_client , request ):
182206 client = test_linode_client
183207
184- target_region = get_region (client , {"LA Disk Encryption" })
208+ target_region = get_region (client , {"Disk Encryption" })
185209 label = get_test_label (length = 8 )
186210
187211 disk_encryption = request .param
@@ -236,7 +260,7 @@ def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
236260def test_linode_rebuild (test_linode_client ):
237261 client = test_linode_client
238262
239- region = get_region (client , {"LA Disk Encryption" })
263+ region = get_region (client , {"Disk Encryption" })
240264
241265 label = get_test_label () + "_rebuild"
242266
@@ -591,9 +615,9 @@ def test_linode_initate_migration(test_linode_client, e2e_test_firewall):
591615
592616def test_linode_upgrade_interfaces (
593617 linode_for_network_interface_tests ,
594- create_vpc_with_subnet_and_linode_offline ,
618+ linode_and_vpc_for_network_interface_tests_offline ,
595619):
596- vpc , subnet , linode , _ = create_vpc_with_subnet_and_linode_offline
620+ vpc , subnet , linode , _ = linode_and_vpc_for_network_interface_tests_offline
597621 config = linode .configs [0 ]
598622
599623 new_interfaces = [
@@ -832,10 +856,11 @@ def test_create_vpu(self, test_linode_client, linode_for_vpu_tests):
832856 def test_create_vpc (
833857 self ,
834858 test_linode_client ,
835- linode_for_network_interface_tests ,
836- create_vpc_with_subnet_and_linode ,
859+ linode_and_vpc_for_network_interface_tests_offline ,
837860 ):
838- vpc , subnet , linode , _ = create_vpc_with_subnet_and_linode
861+ vpc , subnet , linode , _ = (
862+ linode_and_vpc_for_network_interface_tests_offline
863+ )
839864
840865 config : Config = linode .configs [0 ]
841866
@@ -845,7 +870,7 @@ def test_create_vpc(
845870 interface = config .interface_create_vpc (
846871 subnet = subnet ,
847872 primary = True ,
848- ipv4 = ConfigInterfaceIPv4 (vpc = "10.0.0.2 " , nat_1_1 = "any" ),
873+ ipv4 = ConfigInterfaceIPv4 (vpc = "10.0.0.3 " , nat_1_1 = "any" ),
849874 ip_ranges = ["10.0.0.5/32" ],
850875 )
851876
@@ -854,7 +879,7 @@ def test_create_vpc(
854879 assert interface .id == config .interfaces [0 ].id
855880 assert interface .subnet .id == subnet .id
856881 assert interface .purpose == "vpc"
857- assert interface .ipv4 .vpc == "10.0.0.2 "
882+ assert interface .ipv4 .vpc == "10.0.0.3 "
858883 assert interface .ipv4 .nat_1_1 == linode .ipv4 [0 ]
859884 assert interface .ip_ranges == ["10.0.0.5/32" ]
860885
@@ -888,10 +913,11 @@ def test_create_vpc(
888913
889914 def test_update_vpc (
890915 self ,
891- linode_for_network_interface_tests ,
892- create_vpc_with_subnet_and_linode ,
916+ linode_and_vpc_for_network_interface_tests_offline ,
893917 ):
894- vpc , subnet , linode , _ = create_vpc_with_subnet_and_linode
918+ vpc , subnet , linode , _ = (
919+ linode_and_vpc_for_network_interface_tests_offline
920+ )
895921
896922 config : Config = linode .configs [0 ]
897923
@@ -901,11 +927,11 @@ def test_update_vpc(
901927 interface = config .interface_create_vpc (
902928 subnet = subnet ,
903929 primary = True ,
904- ip_ranges = ["10.0.0.5 /32" ],
930+ ip_ranges = ["10.0.0.8 /32" ],
905931 )
906932
907933 interface .primary = False
908- interface .ip_ranges = ["10.0.0.6 /32" ]
934+ interface .ip_ranges = ["10.0.0.9 /32" ]
909935 interface .ipv4 .vpc = "10.0.0.3"
910936 interface .ipv4 .nat_1_1 = "any"
911937
@@ -918,7 +944,7 @@ def test_update_vpc(
918944 assert interface .purpose == "vpc"
919945 assert interface .ipv4 .vpc == "10.0.0.3"
920946 assert interface .ipv4 .nat_1_1 == linode .ipv4 [0 ]
921- assert interface .ip_ranges == ["10.0.0.6 /32" ]
947+ assert interface .ip_ranges == ["10.0.0.9 /32" ]
922948
923949 def test_reorder (self , linode_for_network_interface_tests ):
924950 linode = linode_for_network_interface_tests
0 commit comments