@@ -45,7 +45,7 @@ def lke_cluster(test_linode_client):
4545 cluster .delete ()
4646
4747
48- @pytest .fixture (scope = "session " )
48+ @pytest .fixture (scope = "function " )
4949def lke_cluster_with_acl (test_linode_client ):
5050 node_type = test_linode_client .linode .types ()[1 ] # g6-standard-1
5151 version = test_linode_client .lke .versions ()[0 ]
@@ -288,16 +288,31 @@ def test_lke_cluster_acl(lke_cluster_with_acl):
288288
289289 acl = cluster .control_plane_acl_update (
290290 LKEClusterControlPlaneACLOptions (
291+ enabled = True ,
291292 addresses = LKEClusterControlPlaneACLAddressesOptions (
292293 ipv4 = ["10.0.0.2/32" ]
293- )
294+ ),
294295 )
295296 )
296297
297298 assert acl == cluster .control_plane_acl
298299 assert acl .addresses .ipv4 == ["10.0.0.2/32" ]
299300
300301
302+ def test_lke_cluster_update_acl_null_addresses (lke_cluster_with_acl ):
303+ cluster = lke_cluster_with_acl
304+
305+ # Addresses should not be included in the request if it's null,
306+ # else an error will be returned by the API.
307+ # See: TPT-3489
308+ acl = cluster .control_plane_acl_update (
309+ {"enabled" : False , "addresses" : None }
310+ )
311+
312+ assert acl == cluster .control_plane_acl
313+ assert acl .addresses .ipv4 == []
314+
315+
301316def test_lke_cluster_disable_acl (lke_cluster_with_acl ):
302317 cluster = lke_cluster_with_acl
303318
@@ -311,7 +326,7 @@ def test_lke_cluster_disable_acl(lke_cluster_with_acl):
311326
312327 assert acl .enabled is False
313328 assert acl == cluster .control_plane_acl
314- assert acl .addresses .ipv4 == ["10.0.0.2/32" ]
329+ assert acl .addresses .ipv4 == []
315330
316331 cluster .control_plane_acl_delete ()
317332
0 commit comments