Skip to content

Commit d35ffe8

Browse files
committed
Update test_linode_client and test_account with waits
1 parent f6a02ce commit d35ffe8

2 files changed

Lines changed: 11 additions & 18 deletions

File tree

test/integration/linode_client/test_linode_client.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
from linode_api4.objects import ConfigInterface, ObjectStorageKeys, Region
1010

1111

12+
def is_tag_created(client, tag_label):
13+
tags = client.tags()
14+
tag_label_list = [i.label for i in tags]
15+
16+
return tag_label in tag_label_list
17+
18+
1219
@pytest.fixture(scope="session")
1320
def setup_client_and_linode(test_linode_client, e2e_test_firewall):
1421
client = test_linode_client
@@ -156,11 +163,7 @@ def test_get_tag(test_linode_client, test_tag):
156163
client = test_linode_client
157164
label = test_tag.label
158165

159-
tags = client.tags()
160-
161-
tag_label_list = [i.label for i in tags]
162-
163-
assert label in tag_label_list
166+
assert wait_for_condition(3, 1, is_tag_created, client, label)
164167

165168

166169
def test_create_tag_with_id(
@@ -182,15 +185,10 @@ def test_create_tag_with_id(
182185
volumes=[volume.id, volume],
183186
)
184187

185-
# Get tags after creation
186-
tags = client.tags()
187-
188-
tag_label_list = [i.label for i in tags]
188+
assert wait_for_condition(3, 30, is_tag_created, client, label)
189189

190190
tag.delete()
191191

192-
assert label in tag_label_list
193-
194192

195193
@pytest.mark.smoke
196194
def test_create_tag_with_entities(
@@ -208,15 +206,10 @@ def test_create_tag_with_entities(
208206
label, entities=[linode, domain, nodebalancer, volume]
209207
)
210208

211-
# Get tags after creation
212-
tags = client.tags()
213-
214-
tag_label_list = [i.label for i in tags]
209+
assert wait_for_condition(3, 30, is_tag_created, client, label)
215210

216211
tag.delete()
217212

218-
assert label in tag_label_list
219-
220213

221214
# AccountGroupTests
222215
def test_get_account_settings(test_linode_client):

test/integration/models/account/test_account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get_linode_status():
111111
return linode.status == "running"
112112

113113
# To ensure the Linode is running and the 'event' key has been populated
114-
wait_for_condition(3, 100, get_linode_status)
114+
wait_for_condition(5, 150, get_linode_status)
115115

116116
events = client.load(Event, "")
117117
latest_events = events._raw_json.get("data")[:15]

0 commit comments

Comments
 (0)