File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2124,6 +2124,13 @@ def interface_create(
21242124 :rtype: LinodeInterface
21252125 """
21262126
2127+ if kwargs .get ("rdma_vpc" ) is not None :
2128+ raise ValueError (
2129+ "RDMA VPC interfaces (rdma_vpc) cannot be added via "
2130+ "interface_create(). They may only be specified at instance "
2131+ "creation time via LinodeGroup.instance_create()."
2132+ )
2133+
21272134 params = {
21282135 "firewall_id" : firewall ,
21292136 "default_route" : default_route ,
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ def test_instance_create_with_interfaces_linode_rdma(self):
154154 }
155155
156156 assert m .call_data ["interfaces" ][0 ] == {
157- "firewall_id" : - 1 ,
157+ "firewall_id" : None ,
158158 "rdma_vpc" : {
159159 "subnet_id" : 1234 ,
160160 "ipv4" : {
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ def build_interface_options_vlan():
8282
8383def build_interface_options_rdma_vpc ():
8484 return LinodeInterfaceOptions (
85- firewall_id = - 1 ,
85+ firewall_id = None ,
8686 rdma_vpc = LinodeInterfaceRDMAVPCOptions (
8787 subnet_id = 1234 ,
8888 ipv4 = LinodeInterfaceRDMAVPCIPv4Options (
Original file line number Diff line number Diff line change 33from test .unit .objects .linode_interface_test import (
44 LinodeInterfaceTest ,
55 build_interface_options_public ,
6+ build_interface_options_rdma_vpc ,
67 build_interface_options_vlan ,
78 build_interface_options_vpc ,
89)
@@ -756,6 +757,21 @@ def test_create_interface_vlan(self):
756757
757758 LinodeInterfaceTest .assert_linode_124_interface_789 (result )
758759
760+ def test_create_interface_rdma_vpc_rejected (self ):
761+ """
762+ Tests that attempting to create an RDMA VPC interface via
763+ interface_create() raises a clear ValueError instead of sending an
764+ invalid request to the API.
765+ """
766+ instance = Instance (self .client , 124 )
767+
768+ iface = build_interface_options_rdma_vpc ()
769+
770+ with self .assertRaises (ValueError ) as ctx :
771+ instance .interface_create (** vars (iface ))
772+
773+ assert "rdma_vpc" in str (ctx .exception )
774+
759775
760776class DiskTest (ClientBaseCase ):
761777 """
You can’t perform that action at this time.
0 commit comments