Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linode_api4/objects/nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class NodeBalancer(Base):
"locks": Property(unordered=True),
"type": Property(),
"backend_connectivity": Property(),
"backend_ipv6_prefix": Property(),
}

# create derived objects
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/linode_instances_123_nodebalancers.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"label": "balancer12345",
"type": "premium",
"backend_connectivity": "ipv6",
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96",
"region": "us-east",
"tags": [
"example tag",
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures/nodebalancers.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"tags": ["something"],
"locks": ["cannot_delete_with_subresources"],
"type": "premium",
"backend_connectivity": "ipv6"
"backend_connectivity": "ipv6",
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96"
},
{
"created": "2018-01-01T00:01:01",
Expand All @@ -28,7 +29,8 @@
"tags": [],
"locks": [],
"type": "premium",
"backend_connectivity": "ipv6"
"backend_connectivity": "ipv6",
"backend_ipv6_prefix": null
}
],
"results": 2,
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/nodebalancers_123456.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"cannot_delete_with_subresources"
],
"type": "premium",
"backend_connectivity": "ipv6"
"backend_connectivity": "ipv6",
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96"
}
3 changes: 3 additions & 0 deletions test/integration/models/nodebalancer/test_nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def test_create_nb(test_linode_client, e2e_test_firewall):
assert 5 == nb.client_udp_sess_throttle
assert nb.type == "premium"
assert nb.backend_connectivity == "ipv6"
assert nb.backend_ipv6_prefix is None or isinstance(
nb.backend_ipv6_prefix, str
)

nb.delete()

Expand Down
5 changes: 5 additions & 0 deletions test/unit/linode_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,7 @@ def test_create_with_type_and_backend_connectivity(self):
"label": "my-premium-nb",
"type": "premium",
"backend_connectivity": "ipv6",
"backend_ipv6_prefix": "2600:3c22:1:20:0:3039::/96",
"region": "us-east",
}
) as m:
Expand Down Expand Up @@ -1634,6 +1635,10 @@ def test_create_with_type_and_backend_connectivity(self):
self.assertEqual(nb.id, 1234)
self.assertEqual(nb.type, "premium")
self.assertEqual(nb.backend_connectivity, "ipv6")
self.assertEqual(
nb.backend_ipv6_prefix, "2600:3c22:1:20:0:3039::/96"
)
self.assertNotIn("backend_ipv6_prefix", m.call_data)
Comment thread
zliang-akamai marked this conversation as resolved.

def test_create_with_vpc_backend_connectivity(self):
"""
Expand Down
9 changes: 9 additions & 0 deletions test/unit/objects/nodebalancers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def test_get(self):
self.assertEqual(nb._populated, True)
self.assertEqual(nb.type, "premium")
self.assertEqual(nb.backend_connectivity, "ipv6")
self.assertEqual(nb.backend_ipv6_prefix, "2600:3c22:1:20:0:3039::/96")

def test_update(self):
"""
Expand Down Expand Up @@ -244,6 +245,7 @@ def test_type_and_backend_connectivity_not_in_put(self):
self.assertEqual(m.call_url, "/nodebalancers/123456")
self.assertNotIn("type", m.call_data)
self.assertNotIn("backend_connectivity", m.call_data)
self.assertNotIn("backend_ipv6_prefix", m.call_data)
self.assertEqual(m.call_data["label"], "new-label")

def test_firewalls(self):
Expand All @@ -258,6 +260,13 @@ def test_firewalls(self):
self.assertEqual(m.call_url, firewalls_url)
self.assertEqual(len(result), 1)

def test_backend_ipv6_prefix_null(self):
"""
Test that a NodeBalancer can have a null backend IPv6 prefix.
"""
nb = NodeBalancer(self.client, 123457)
self.assertIsNone(nb.backend_ipv6_prefix)

def test_config_rebuild(self):
"""
Test that you can rebuild the cofig of a node balancer.
Expand Down
Loading