99from 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" )
1320def 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
166169def 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
196194def 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
222215def test_get_account_settings (test_linode_client ):
0 commit comments