Skip to content

Commit c3c3225

Browse files
Integration test fixes (#715)
* Fix Object Storage bucket creation to initialize the region used by subsequent API requests * Remove outdated tests * make format * Fix test_get_linode_types_overrides and merge it with another test case * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 8ca2763 commit c3c3225

5 files changed

Lines changed: 6 additions & 34 deletions

File tree

linode_api4/groups/object_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ def bucket_create(
429429
json=result,
430430
)
431431

432-
return ObjectStorageBucket(
433-
self.client, result["label"], result["cluster"], result
432+
return ObjectStorageBucket.make_instance(
433+
result["label"], self.client, json=result
434434
)
435435

436436
def object_acl_config(self, cluster_or_region_id: str, bucket, name=None):

test/integration/models/linode/test_linode.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -848,21 +848,14 @@ def test_get_linode_types(test_linode_client):
848848
for linode_type in types:
849849
assert hasattr(linode_type, "accelerated_devices")
850850

851-
852-
def test_get_linode_types_overrides(test_linode_client):
853-
types = test_linode_client.linode.types()
854-
855-
target_types = [
851+
regional_priced_types = [
856852
v
857853
for v in types
858854
if len(v.region_prices) > 0 and v.region_prices[0].hourly > 0
859855
]
860856

861-
assert len(target_types) > 0
862-
863-
for linode_type in target_types:
864-
assert linode_type.region_prices[0].hourly >= 0
865-
assert linode_type.region_prices[0].monthly >= 0
857+
assert any(v.region_prices[0].hourly > 0 for v in regional_priced_types)
858+
assert any(v.region_prices[0].monthly > 0 for v in regional_priced_types)
866859

867860

868861
@pytest.mark.flaky(reruns=3, reruns_delay=2)

test/integration/models/lke/test_lke.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import base64
2-
import re
32
from test.integration.conftest import get_region
43
from test.integration.helpers import (
54
get_test_label,
@@ -226,16 +225,6 @@ def test_node_pool_create_with_disk_encryption(test_linode_client, lke_cluster):
226225
pool.delete()
227226

228227

229-
def test_cluster_dashboard_url_view(lke_cluster):
230-
cluster = lke_cluster
231-
232-
url = send_request_when_resource_available(
233-
300, cluster.cluster_dashboard_url_view
234-
)
235-
236-
assert re.search("https://+", url)
237-
238-
239228
def test_get_and_delete_kubeconfig(lke_cluster):
240229
cluster = lke_cluster
241230

test/unit/linode_client_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,7 @@ def test_bucket_create(self):
13341334
"us-east-1", "example-bucket", ObjectStorageACL.PRIVATE, True
13351335
)
13361336
self.assertIsNotNone(b)
1337+
self.assertEqual(b.region, "us-east-1")
13371338
self.assertEqual(m.call_url, "/object-storage/buckets")
13381339
self.assertEqual(
13391340
m.call_data,

test/unit/objects/lke_test.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,6 @@ def test_get_pool(self):
6868
assert pool.taints[0].value == "bar"
6969
assert pool.taints[0].effect == "NoSchedule"
7070

71-
def test_cluster_dashboard_url_view(self):
72-
"""
73-
Tests that you can submit a correct cluster dashboard url api request.
74-
"""
75-
cluster = LKECluster(self.client, 18881)
76-
77-
with self.mock_get("/lke/clusters/18881/dashboard") as m:
78-
result = cluster.cluster_dashboard_url_view()
79-
self.assertEqual(m.call_url, "/lke/clusters/18881/dashboard")
80-
self.assertEqual(result, "https://example.dashboard.linodelke.net")
81-
8271
def test_kubeconfig_delete(self):
8372
"""
8473
Tests that you can submit a correct kubeconfig delete api request.

0 commit comments

Comments
 (0)